use proxies

This commit is contained in:
SickBeard Custom User 2014-04-23 11:48:07 +01:00
parent f8ec897010
commit aae27f36f6
2 changed files with 12 additions and 2 deletions

View File

@ -312,8 +312,13 @@ class KATProvider(generic.TorrentProvider):
parsed = list(urlparse.urlparse(url))
parsed[2] = re.sub("/{2,}", "/", parsed[2]) # replace two or more / with one
url = urlparse.urlunparse(parsed)
proxies = {
"http": "http://192.168.1.11:8118",
"https": "http://192.168.1.11:8118",
}
r = requests.get(url)
r = requests.get(url, proxies=proxies)
except (requests.exceptions.ConnectionError, requests.exceptions.HTTPError), e:
logger.log(u"Error loading " + self.name + " URL: " + str(sys.exc_info()) + " - " + ex(e), logger.ERROR)
return None

View File

@ -307,8 +307,13 @@ class ThePirateBayProvider(generic.TorrentProvider):
if self.proxy.isEnabled():
headers.update({'referer': self.proxy.getProxyURL()})
proxies = {
"http": "http://192.168.1.11:8118",
"https": "http://192.168.1.11:8118",
}
try:
r = requests.get(url, headers=headers)
r = requests.get(url, headers=headers, proxies=proxies)
except (requests.exceptions.ConnectionError, requests.exceptions.HTTPError), e:
logger.log(u"Error loading " + self.name + " URL: " + str(sys.exc_info()) + " - " + ex(e), logger.ERROR)
return None