Fixed send_note pushbullet method

This commit is contained in:
Fabio Manganiello 2018-10-01 15:06:26 +02:00
parent d419419487
commit fbce006772
1 changed files with 7 additions and 8 deletions

View File

@ -21,21 +21,20 @@ class PushbulletPlugin(Plugin):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
@action @action
def send_push(self, **kwargs): def send_note(self, body=None, title=None, **kwargs):
""" """
Send a push. Send a note push.
:param kwargs: Push arguments, see https://docs.pushbullet.com/#create-push :param kwargs: Push arguments, see https://docs.pushbullet.com/#create-push
:type kwargs: dict :type kwargs: dict
""" """
pushbullet = get_backend('pushbullet') pushbullet = get_backend('pushbullet')
resp = requests.post('https://api.pushbullet.com/v2/ephemerals', kwargs['body'] = body
data=json.dumps({ kwargs['title'] = title
'type':'push', kwargs['type'] = 'note'
'push': kwargs, resp = requests.post('https://api.pushbullet.com/v2/pushes',
}), data=json.dumps(kwargs),
headers={'Authorization': 'Bearer ' + pushbullet.token, headers={'Authorization': 'Bearer ' + pushbullet.token,
'Content-Type': 'application/json'}) 'Content-Type': 'application/json'})