From 50dc83892f0fcc98c6a0502be60a8d42973b7ef0 Mon Sep 17 00:00:00 2001 From: "Scott D. Barker" Date: Wed, 17 Sep 2014 20:24:27 -0700 Subject: [PATCH] - Update Pushbullet notifier to no longer base64 encode the API key which was causing Pushbullet to reject the key and connections - Update Pushbullet notifier's authorization header to reflect their API - Update the JS that populates the Pushbullet device list to provide an "All Devices" option --- gui/slick/js/configNotifications.js | 1 + sickbeard/notifiers/pushbullet.py | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/gui/slick/js/configNotifications.js b/gui/slick/js/configNotifications.js index 342bec4f..847236c6 100644 --- a/gui/slick/js/configNotifications.js +++ b/gui/slick/js/configNotifications.js @@ -267,6 +267,7 @@ $(document).ready(function(){ function (data) { var devices = jQuery.parseJSON(data).devices; $("#pushbullet_device_list").html(''); + $("#pushbullet_device_list").append('') for (var i = 0; i < devices.length; i++) { if(devices[i].active == true) { if(current_pushbullet_device == devices[i].iden) { diff --git a/sickbeard/notifiers/pushbullet.py b/sickbeard/notifiers/pushbullet.py index fedf3fa2..64c24fed 100644 --- a/sickbeard/notifiers/pushbullet.py +++ b/sickbeard/notifiers/pushbullet.py @@ -79,13 +79,11 @@ class PushbulletNotifier: http_handler = HTTPSConnection("api.pushbullet.com") - authString = base64.encodestring('%s:' % (pushbullet_api)).replace('\n', '') - if notificationType == None: testMessage = True try: logger.log(u"Testing Pushbullet authentication and retrieving the device list.", logger.DEBUG) - http_handler.request(method, uri, None, headers={'Authorization': 'Basic %s:' % authString}) + http_handler.request(method, uri, None, headers={'Authorization': 'Bearer %s' % pushbullet_api}) except (SSLError, HTTPException, socket.error): logger.log(u"Pushbullet notification failed.", logger.ERROR) return False @@ -99,7 +97,7 @@ class PushbulletNotifier: 'type': notificationType} data = json.dumps(data) http_handler.request(method, uri, body=data, - headers={'Content-Type': 'application/json', 'Authorization': 'Basic %s' % authString}) + headers={'Content-Type': 'application/json', 'Authorization': 'Bearer %s' % pushbullet_api}) pass except (SSLError, HTTPException, socket.error): return False