package for interacting with pushbullet via python
Project description
PushBullet Messaging and Alerting tools
Installation
pip install pushbullet_tools
pbmsg config YOUR_PUSHBULLET_API_TOKEN
This will store your API token using your user's local python keyring.
Command-line Usage
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>
Context Manager
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 **/
The messages can be customized and a closing_func
can be assign to run after
process regardless of whether an error is thrown.
Sending messages in python
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')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pushbullet_tools-0.0.5.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for pushbullet_tools-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9c29a38b58e7612f3e4e38277108ceab3f39e43e58449d47c1d1f63808c79b9 |
|
MD5 | ee4ccd7c3781ae95f6c32390d450e14e |
|
BLAKE2b-256 | 3dac7a4e259c0b5471c378d470ff8ce07ba5126c411e6f63817f1a834f69f81d |