Pushbullet setup for monitoring...
I recently setup a home server and wanted to use pushbullet for notifications. I wittily thought that pbull would be a good name for my personal module (which sounds a bit like pit bull, the dog not the rapper). Thus the class called Bark... woof.
It turned out to be tremendously useful, so I share it here. Let me know if you have any questions.
The only two parts that need to be updated are the nickname of you personal device where you want to receive the notifications and the API key from your account.
from pushbullet.pushbullet import Pushbullet
class bark:
def __init__(self):
key = '[ENTER YOUR API KEY HERE]'
self.pb = Pushbullet(api_key=key)
self.iden = None
self.get_my_phone()
def get_my_phone(self, nickname="[ENTER YOUR PHONE NAME]"):
print self.pb.list_devices()
devices = self.pb.list_devices()['devices']
for device in devices:
try:
if device['nickname'] == nickname:
self.iden = device['iden']
except:
print "no device"
def message(self, title, body):
print self.iden
self.pb.bullet_note(self.iden, title, body)
Once you have the class built, you can create a command line version pretty easily. The code can go in your site-packages for easy importing into any project.