diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index da7a7cac..6782ce00 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -291,18 +291,22 @@ class PlexAPI(): authenticate=False, headerOptions=headerOptions, verifySSL=verifySSL) - if answer is False: + if answer is None: self.logMsg("Could not connect to %s" % url, 0) count += 1 xbmc.sleep(500) continue try: + # xml received? answer.attrib except: - pass + if answer is True: + # Maybe no xml but connection was successful nevertheless + answer = 200 else: # Success - we downloaded an xml! answer = 200 + # We could connect but maybe were not authenticated. No worries self.logMsg("Checking connection successfull. Answer: %s" % answer, 1) return answer diff --git a/resources/lib/downloadutils.py b/resources/lib/downloadutils.py index 9aba8f18..678146ec 100644 --- a/resources/lib/downloadutils.py +++ b/resources/lib/downloadutils.py @@ -165,7 +165,7 @@ class DownloadUtils(): Otherwise, 'empty' request will be made Returns: - False If an error occured + None If an error occured True If connection worked but no body was received 401, ... integer if PMS answered with HTTP error 401 (unauthorized) or other http error codes diff --git a/resources/lib/initialsetup.py b/resources/lib/initialsetup.py index 7fcf8517..68d01e32 100644 --- a/resources/lib/initialsetup.py +++ b/resources/lib/initialsetup.py @@ -53,15 +53,8 @@ class InitialSetup(): if (plexToken and myplexlogin == 'true' and forcePlexTV is False and chooseServer is False): chk = self.plx.CheckConnection('plex.tv', plexToken) - try: - chk.attrib - except: - pass - else: - # Success - we downloaded an xml! - chk = 200 - # HTTP Error: unauthorized. Token is no longer valid if chk in (401, 403): + # HTTP Error: unauthorized. Token is no longer valid self.logMsg('plex.tv connection returned HTTP %s' % chk, 0) # Delete token in the settings utils.settings('plexToken', value='')