From 311a8c6fa31ac2015abd0bd6d2f9a5084b9be56f Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Fri, 20 May 2016 20:44:16 -0700 Subject: [PATCH] Try using requests for Join notifications --- plexpy/notifiers.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/plexpy/notifiers.py b/plexpy/notifiers.py index ac3b2989..983b34a2 100644 --- a/plexpy/notifiers.py +++ b/plexpy/notifiers.py @@ -2569,18 +2569,12 @@ class JOIN(object): 'title': subject.encode("utf-8"), 'text': message.encode("utf-8")} - http_handler = HTTPSConnection("joinjoaomgcd.appspot.com") - http_handler.request("POST", - "/_ah/api/messaging/v1/sendPush?%s" % urlencode(data)) - - response = http_handler.getresponse() - request_status = response.status - # logger.debug(u"PushBullet response status: %r" % request_status) - # logger.debug(u"PushBullet response headers: %r" % response.getheaders()) - # logger.debug(u"PushBullet response body: %r" % response.read()) + response = requests.post('https://joinjoaomgcd.appspot.com/_ah/api/messaging/v1/sendPush', + params=data) + request_status = response.status_code if request_status == 200: - data = json.loads(response.read()) + data = json.loads(response.text) if data.get('success'): logger.info(u"PlexPy Notifiers :: Join notification sent.") return True