Fixed some issues with login/pass posting

This commit is contained in:
echel0n 2018-06-21 20:16:14 -07:00
commit 9306230f7e
2 changed files with 4 additions and 6 deletions

View file

@ -282,7 +282,7 @@ class autoProcessTV(object):
if section == "SickBeard":
logger.debug("Opening URL: {0} with params: {1}".format(url, fork_params), section)
s = requests.Session()
if not apikey:
if not apikey and username and password:
login = "{0}{1}:{2}{3}/login".format(protocol, host, port, web_root)
login_params = {'username': username, 'password': password}
s.post(login, data=login_params, stream=True, verify=False, timeout=(30, 60))

View file

@ -62,15 +62,13 @@ def autoFork(section, inputCategory):
# attempting to auto-detect fork
try:
if username and password:
s = requests.Session()
s = requests.Session()
if not apikey and username and password:
login = "{protocol}{host}:{port}{root}/login".format(
protocol=protocol, host=host, port=port, root=web_root)
login_params = {'username': username, 'password': password}
s.post(login, data=login_params, stream=True, verify=False)
r = s.get(url, auth=(username, password), verify=False)
else:
r = requests.get(url, verify=False)
r = s.get(url, auth=(username, password), verify=False)
except requests.ConnectionError:
logger.info("Could not connect to {section}:{category} to perform auto-fork detection!".format
(section=section, category=inputCategory))