DoUtils: use authenticate instead of dontSignout
This commit is contained in:
parent
9d06225228
commit
47938cf5c2
3 changed files with 10 additions and 8 deletions
|
@ -291,8 +291,7 @@ class PlexAPI():
|
|||
answer = self.doUtils(url,
|
||||
authenticate=False,
|
||||
headerOptions=headerOptions,
|
||||
verifySSL=verifySSL,
|
||||
dontSignout=True)
|
||||
verifySSL=verifySSL)
|
||||
if answer is False:
|
||||
self.logMsg("Could not connect to %s" % url, 0)
|
||||
count += 1
|
||||
|
|
|
@ -421,8 +421,7 @@ def PMSHttpsEnabled(url):
|
|||
doUtils = downloadutils.DownloadUtils().downloadUrl
|
||||
res = doUtils('https://%s/identity' % url,
|
||||
authenticate=False,
|
||||
verifySSL=False,
|
||||
dontSignout=True)
|
||||
verifySSL=False)
|
||||
try:
|
||||
res.attrib
|
||||
except:
|
||||
|
|
|
@ -145,8 +145,7 @@ class DownloadUtils():
|
|||
return r
|
||||
|
||||
def downloadUrl(self, url, type="GET", postBody=None, parameters=None,
|
||||
authenticate=True, headerOptions=None, verifySSL=True,
|
||||
dontSignout=False):
|
||||
authenticate=True, headerOptions=None, verifySSL=True):
|
||||
"""
|
||||
Override SSL check with verifySSL=False
|
||||
|
||||
|
@ -200,7 +199,7 @@ class DownloadUtils():
|
|||
# THE EXCEPTIONS
|
||||
except requests.exceptions.ConnectionError as e:
|
||||
# Connection error
|
||||
if dontSignout is False:
|
||||
if authenticate is False:
|
||||
self.logMsg("Server unreachable at: %s" % url, -1)
|
||||
self.logMsg(e, 2)
|
||||
# Make the addon aware of status
|
||||
|
@ -233,6 +232,11 @@ class DownloadUtils():
|
|||
self.logMsg(e, 2)
|
||||
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:
|
||||
self.logMsg("Unknown error connecting to: %s" % url, -1)
|
||||
self.logMsg("Error message: %s" % e, 2)
|
||||
|
@ -255,7 +259,7 @@ class DownloadUtils():
|
|||
return True
|
||||
|
||||
elif r.status_code == 401:
|
||||
if dontSignout is True:
|
||||
if authenticate is False:
|
||||
# Called when checking a connect - no need for rash action
|
||||
return 401
|
||||
r.encoding = 'utf-8'
|
||||
|
|
Loading…
Reference in a new issue