From 9306230f7e37507f64f22db8c7ff6b13f752ce73 Mon Sep 17 00:00:00 2001 From: echel0n Date: Thu, 21 Jun 2018 20:16:14 -0700 Subject: [PATCH] Fixed some issues with login/pass posting --- core/autoProcess/autoProcessTV.py | 2 +- core/nzbToMediaAutoFork.py | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/core/autoProcess/autoProcessTV.py b/core/autoProcess/autoProcessTV.py index 8e14a2e2..2f60d709 100644 --- a/core/autoProcess/autoProcessTV.py +++ b/core/autoProcess/autoProcessTV.py @@ -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)) diff --git a/core/nzbToMediaAutoFork.py b/core/nzbToMediaAutoFork.py index 2deaf3b6..91d90cc6 100644 --- a/core/nzbToMediaAutoFork.py +++ b/core/nzbToMediaAutoFork.py @@ -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))