Merge pull request #141 from centicosm/master

Fixed regression involving invalid token requirement
This commit is contained in:
Michael Shepanski 2017-04-25 21:17:30 -04:00 committed by GitHub
commit 71341def2d
2 changed files with 3 additions and 3 deletions

View file

@ -171,8 +171,8 @@ class PlexClient(PlexObject):
def url(self, key):
""" Build a URL string with proper token argument. """
if not self._baseurl or not self._token:
raise BadRequest('PlexClient object missing baseurl or token.')
if not self._baseurl:
raise BadRequest('PlexClient object missing baseurl.')
if self._token:
delim = '&' if '?' in key else '?'
return '%s%s%sX-Plex-Token=%s' % (self._baseurl, key, delim, self._token)

View file

@ -208,7 +208,7 @@ class PlexServer(PlexObject):
for elem in self.query('/clients'):
if elem.attrib.get('name').lower() == name.lower():
baseurl = 'http://%s:%s' % (elem.attrib['host'], elem.attrib['port'])
return PlexClient(baseurl, server=self, data=elem)
return PlexClient(baseurl=baseurl, server=self, data=elem)
raise NotFound('Unknown client name: %s' % name)
def createPlaylist(self, title, items):