DoUtils: use authenticate instead of dontSignout

This commit is contained in:
tomkat83 2016-04-13 10:48:45 +02:00
parent 9d06225228
commit 47938cf5c2
3 changed files with 10 additions and 8 deletions

View file

@ -291,8 +291,7 @@ class PlexAPI():
answer = self.doUtils(url, answer = self.doUtils(url,
authenticate=False, authenticate=False,
headerOptions=headerOptions, headerOptions=headerOptions,
verifySSL=verifySSL, verifySSL=verifySSL)
dontSignout=True)
if answer is False: if answer is False:
self.logMsg("Could not connect to %s" % url, 0) self.logMsg("Could not connect to %s" % url, 0)
count += 1 count += 1

View file

@ -421,8 +421,7 @@ def PMSHttpsEnabled(url):
doUtils = downloadutils.DownloadUtils().downloadUrl doUtils = downloadutils.DownloadUtils().downloadUrl
res = doUtils('https://%s/identity' % url, res = doUtils('https://%s/identity' % url,
authenticate=False, authenticate=False,
verifySSL=False, verifySSL=False)
dontSignout=True)
try: try:
res.attrib res.attrib
except: except:

View file

@ -145,8 +145,7 @@ class DownloadUtils():
return r return r
def downloadUrl(self, url, type="GET", postBody=None, parameters=None, def downloadUrl(self, url, type="GET", postBody=None, parameters=None,
authenticate=True, headerOptions=None, verifySSL=True, authenticate=True, headerOptions=None, verifySSL=True):
dontSignout=False):
""" """
Override SSL check with verifySSL=False Override SSL check with verifySSL=False
@ -200,7 +199,7 @@ class DownloadUtils():
# THE EXCEPTIONS # THE EXCEPTIONS
except requests.exceptions.ConnectionError as e: except requests.exceptions.ConnectionError as e:
# Connection error # Connection error
if dontSignout is False: if authenticate is False:
self.logMsg("Server unreachable at: %s" % url, -1) self.logMsg("Server unreachable at: %s" % url, -1)
self.logMsg(e, 2) self.logMsg(e, 2)
# Make the addon aware of status # Make the addon aware of status
@ -233,6 +232,11 @@ class DownloadUtils():
self.logMsg(e, 2) self.logMsg(e, 2)
return False return False
except requests.exceptions.TooManyRedirects as e:
self.logMsg("Too many redirects connecting to: %s" % url, -1)
self.logMsg(e, 2)
return False
except requests.exceptions.RequestException as e: except requests.exceptions.RequestException as e:
self.logMsg("Unknown error connecting to: %s" % url, -1) self.logMsg("Unknown error connecting to: %s" % url, -1)
self.logMsg("Error message: %s" % e, 2) self.logMsg("Error message: %s" % e, 2)
@ -255,7 +259,7 @@ class DownloadUtils():
return True return True
elif r.status_code == 401: elif r.status_code == 401:
if dontSignout is True: if authenticate is False:
# Called when checking a connect - no need for rash action # Called when checking a connect - no need for rash action
return 401 return 401
r.encoding = 'utf-8' r.encoding = 'utf-8'