From 59ce3404c9deca625013a535aec738c7a969124b Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Sat, 5 Nov 2016 11:48:53 -0700 Subject: [PATCH] Fix Plex.tv authentication with special characters --- plexpy/plextv.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plexpy/plextv.py b/plexpy/plextv.py index fa99815d..03de5b31 100644 --- a/plexpy/plextv.py +++ b/plexpy/plextv.py @@ -144,7 +144,7 @@ class PlexTV(object): Plex.tv authentication """ - def __init__(self, username=None, password=None, token=None): + def __init__(self, username='', password='', token=None): self.protocol = 'HTTPS' self.username = username self.password = password @@ -168,7 +168,7 @@ class PlexTV(object): def get_plex_auth(self, output_format='raw'): uri = '/users/sign_in.xml' - base64string = base64.encodestring('%s:%s' % (self.username, self.password)).replace('\n', '') + base64string = base64.b64encode(('%s:%s' % (self.username, self.password)).encode('utf-8')) headers = {'Content-Type': 'application/xml; charset=utf-8', 'X-Plex-Device-Name': 'PlexPy', 'X-Plex-Product': 'PlexPy',