From 8cdf1ddbee5d8e4d90673b48dc2672697e239f07 Mon Sep 17 00:00:00 2001 From: Julio Melendez Date: Sun, 31 Aug 2014 11:10:00 -0500 Subject: [PATCH] Switch from urlencode to json Per the Pushbullet API (https://docs.pushbullet.com/http/) the POST should use a JSON body, with content-type 'application/json' --- sickbeard/notifiers/pushbullet.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sickbeard/notifiers/pushbullet.py b/sickbeard/notifiers/pushbullet.py index 8a731e1a..274d9715 100644 --- a/sickbeard/notifiers/pushbullet.py +++ b/sickbeard/notifiers/pushbullet.py @@ -20,7 +20,7 @@ import base64 from httplib import HTTPSConnection, HTTPException -from urllib import urlencode +import json from ssl import SSLError import sickbeard from sickbeard import logger, common @@ -97,8 +97,9 @@ class PushbulletNotifier: 'body': message.encode('utf-8'), 'device_iden': pushbullet_device, 'type': notificationType} - http_handler.request(method, uri, body=urlencode(data), - headers={'Authorization': 'Basic %s' % authString}) + data = json.dumps(data) + http_handler.request(method, uri, body=data, + headers={'Content-Type': 'application/json', 'Authorization': 'Basic %s' % authString}) pass except (SSLError, HTTPException): return False