To use this you should get the pushbullet app on your phone. On your computer, first go to the pushbullet website, and create an account. Then go to Settings and click Create Access Token. Copy this token as you will need it for configuring pushbullet_tools.
Read the docs.
pip install pushbullet_tools
pbmsg config YOUR_PUSHBULLET_API_TOKEN
This will store your API token using your user's local python keyring.
Some setups may also require an additional install. If config fails due to no available keyrings backend being found. Use: pip install keyrings.alt
pbmsg push -m 'push a simple message'
pbmsg push --title 'message title' -m 'message body'
pbmsg push --link <URL> --title 'Link Title' --body 'additional message to include'
pbmsg push --file <FILE_URL>
The pushbullet_tools.push_alert
context manager you can execute a process and
receive a push notification on process completion or on error.
import pushbullet_tools as pbt
with pbt.push_alert():
/** insert long running process here **/
with pbt.push_alert(title='With love from {username}',
success_msg='This Turkey is cooked!',
fail_msg='There was a problem see: {error}',
closing_func=cleanup_func):
/** do lots of stuff **/
# It can also be used as a decorator
@pbt.push_alert()
def foo(a,b,c):
print(a + b + c)
foo(1,2,3) # will send notification on completion or error
The messages can be customized and a closing_func
can be assign to run after
process regardless of whether an error is thrown.
from pushbullet_tools import push_message as pm
pm.push_note(pm.HOSTNAME, pm.USERNAME + ' says hi')
pm.push_link('link title', 'some message context', 'link URL')
pm.push_file('some_file.py', 'text/python', 'https://file.download.url')