Change Pushbullet to use Access-Token header

This commit is contained in:
JonnyWong16 2017-02-11 11:02:21 -08:00
commit 67e5c7de2c

View file

@ -2080,8 +2080,10 @@ class PUSHBULLET(Notifier):
http_handler = HTTPSConnection("api.pushbullet.com") http_handler = HTTPSConnection("api.pushbullet.com")
http_handler.request("POST", http_handler.request("POST",
"/v2/pushes", "/v2/pushes",
headers={'Content-type': "application/json", headers={
'Authorization': 'Basic %s' % base64.b64encode(self.config['apikey'] + ":")}, 'Content-type': "application/json",
'Access-Token': self.config['apikey']
},
body=json.dumps(data)) body=json.dumps(data))
response = http_handler.getresponse() response = http_handler.getresponse()
request_status = response.status request_status = response.status
@ -2099,9 +2101,12 @@ class PUSHBULLET(Notifier):
def get_devices(self): def get_devices(self):
if self.config['apikey']: if self.config['apikey']:
http_handler = HTTPSConnection("api.pushbullet.com") http_handler = HTTPSConnection("api.pushbullet.com")
http_handler.request("GET", "/v2/devices", http_handler.request("GET",
headers={'Content-type': "application/json", "/v2/devices",
'Authorization': 'Basic %s' % base64.b64encode(self.config['apikey'] + ":")}) headers={
'Content-type': "application/json",
'Access-Token': self.config['apikey']
})
response = http_handler.getresponse() response = http_handler.getresponse()
request_status = response.status request_status = response.status