1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-13 11:32:20 -05:00

Fix for #390, add flag to use proxy settings

This commit is contained in:
Peter Maciocia 2014-05-06 11:25:30 +01:00
parent 9084d7de19
commit 36359b1547
2 changed files with 6 additions and 4 deletions

View File

@ -165,7 +165,7 @@ def sanitizeFileName(name):
return name return name
def getURL(url, post_data=None, headers=None, params=None, timeout=30, json=False): def getURL(url, post_data=None, headers=None, params=None, timeout=30, json=False, use_proxy=False):
""" """
Returns a byte-string retrieved from the url provider. Returns a byte-string retrieved from the url provider.
""" """
@ -186,8 +186,10 @@ def getURL(url, post_data=None, headers=None, params=None, timeout=30, json=Fals
url = urlparse.urlunparse(parsed) url = urlparse.urlunparse(parsed)
it = iter(req_headers) it = iter(req_headers)
if sickbeard.PROXY_SETTING:
if use_proxy and sickbeard.PROXY_SETTING:
logger.log("Using proxy for url: " + url, logger.DEBUG)
proxies = { proxies = {
"http": sickbeard.PROXY_SETTING, "http": sickbeard.PROXY_SETTING,
"https": sickbeard.PROXY_SETTING, "https": sickbeard.PROXY_SETTING,

View File

@ -114,7 +114,7 @@ class GenericProvider:
if not headers: if not headers:
headers = [] headers = []
data = helpers.getURL(url, post_data, headers, json=json) data = helpers.getURL(url, post_data, headers, json=json, use_proxy=True)
if not data: if not data:
logger.log(u"Error loading " + self.name + " URL: " + url, logger.ERROR) logger.log(u"Error loading " + self.name + " URL: " + url, logger.ERROR)