Fixes all SSL issues

This commit is contained in:
echel0n 2014-04-23 10:27:14 -07:00
commit 41e0d10e25
8 changed files with 26 additions and 31 deletions

View file

@ -53,7 +53,7 @@ class autoProcessComics:
logger.debug("Opening URL: %s" % (url), section)
try:
r = requests.get(url, params=params, auth=(username, password), stream=True)
r = requests.get(url, params=params, auth=(username, password), stream=True, verify=False)
except requests.ConnectionError:
logger.error("Unable to open URL", section)
return 1 # failure

View file

@ -58,7 +58,7 @@ class autoProcessGames:
logger.debug("Opening URL: %s" % (url),section)
try:
r = requests.get(url, params=params)
r = requests.get(url, params=params, verify=False)
except requests.ConnectionError:
logger.error("Unable to open URL")
return 1 # failure

View file

@ -26,7 +26,7 @@ class autoProcessMovie:
logger.debug("Opening URL: %s" % url)
try:
r = requests.get(url, params=params)
r = requests.get(url, params=params, verify=False)
except requests.ConnectionError:
logger.error("Unable to open URL %s" % url)
return
@ -173,12 +173,12 @@ class autoProcessMovie:
url = "%s%s" % (baseURL, command)
logger.debug("Opening URL: %s" % (url), section)
logger.debug("Opening URL: %s with PARAMS: %s" % (url, params), section)
logger.postprocess("Starting %s scan for %s" % (method, inputName), section)
try:
r = requests.get(url, params=params)
r = requests.get(url, params=params, verify=False)
except requests.ConnectionError:
logger.error("Unable to open URL", section)
return 1 # failure
@ -209,10 +209,12 @@ class autoProcessMovie:
logger.postprocess("Setting failed release %s to ignored ..." % (inputName), section)
url = baseURL + "/release.ignore"
logger.debug("Opening URL: %s" % (url), section)
params = {'id': release_id}
logger.debug("Opening URL: %s with PARAMS: %s" % (url, params), section)
try:
r = requests.get(url, params={'id': release_id})
r = requests.get(url, params=params, verify=False)
except requests.ConnectionError:
logger.error("Unable to open URL %s" % (url), section)
return 1 # failure

View file

@ -7,22 +7,20 @@ from nzbtomedia.nzbToMediaUtil import convert_to_ascii, joinPath
from nzbtomedia import logger
class autoProcessMusic:
def get_status(self, baseURL, apikey, dirName):
def get_status(self, url, apikey, dirName):
logger.debug("Attempting to get current status for release:%s" % (os.path.basename(dirName)))
url = baseURL
params = {}
params['apikey'] = apikey
params['cmd'] = "getHistory"
logger.debug("Opening URL: %s" % (url))
logger.debug("Opening URL: %s with PARAMS: %s" % (url, params))
try:
r = requests.get(url, params=params)
except requests.ConnectionError:
r = requests.get(url, params=params, verify=False)
except Exception, e:
logger.error("Unable to open URL")
return None, None
return
try:
result = r.json()
@ -80,21 +78,16 @@ class autoProcessMusic:
params['dir'] = joinPath(remote_path, os.path.basename(os.path.dirname(dirName)))
release_status = self.get_status(url, apikey, dirName)
if release_status:
if release_status not in ["unprocessed", "snatched"]:
logger.warning("%s is marked with a status of %s, skipping ..." % (inputName, release_status),section)
return 0
else:
logger.error("Could not find a status for %s" % (inputName),section)
if not release_status:
logger.error("Could not find a status for %s, is it in the wanted list ?" % (inputName),section)
return 1
logger.debug("Opening URL: %s" % (url),section)
logger.debug("Opening URL: %s with PARAMS: %s" % (url, params), section)
try:
r = requests.get(url, params=params)
r = requests.get(url, params=params, verify=False)
except requests.ConnectionError:
logger.error("Unable to open URL %s" % (url),section)
logger.error("Unable to open URL %s" % (url) ,section)
return 1 # failure
logger.debug("Result: %s" % (r.text),section)

View file

@ -145,11 +145,11 @@ class autoProcessTV:
try:
r = None
if section == "SickBeard":
r = requests.get(url, auth=(username, password), params=fork_params, stream=True)
r = requests.get(url, auth=(username, password), params=fork_params, stream=True, verify=False)
elif section == "NzbDrone":
params = {"name": "DownloadedEpisodesScan", "path": dirName}
headers = {"X-Api-Key": apikey}
r = requests.get(url, params=params, headers=headers, stream=True)
r = requests.get(url, params=params, headers=headers, stream=True, verify=False)
except requests.ConnectionError:
logger.error("Unable to open URL: %s" % (url), section)
return 1 # failure

View file

@ -22,7 +22,7 @@ class GitHub(object):
if params and type(params) is dict:
url += '?' + '&'.join([str(x) + '=' + str(params[x]) for x in params.keys()])
data = requests.get(url)
data = requests.get(url, verify=False)
if data.ok:
json_data = data.json()

View file

@ -55,9 +55,9 @@ def autoFork(inputCategory):
# attempting to auto-detect fork
try:
if username and password:
r = requests.get(url, auth=(username, password))
r = requests.get(url, auth=(username, password), verify=False)
else:
r = requests.get(url)
r = requests.get(url, verify=False)
except requests.ConnectionError:
logger.info("Could not connect to %s:%s to perform auto-fork detection!" % (section, inputCategory))
break

View file

@ -563,7 +563,7 @@ def find_download(clientAgent, download_id):
params['output'] = 'json'
params['value'] = download_id
try:
r = requests.get(url, params=params)
r = requests.get(url, params=params, verify=False)
except requests.ConnectionError:
logger.error("Unable to open URL")
return 1 # failure
@ -662,7 +662,7 @@ def find_imdbid(dirName, inputName):
logger.debug("Opening URL: %s" % url)
try:
r = requests.get(url, params={'y': year, 't': title})
r = requests.get(url, params={'y': year, 't': title}, verify=False)
except requests.ConnectionError:
logger.error("Unable to open URL %s" % url)
return