Fix Plex.tv authentication with special characters

This commit is contained in:
JonnyWong16 2016-11-05 11:48:53 -07:00
commit 59ce3404c9

View file

@ -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',