aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/feedgetter.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyaggr3g470r/feedgetter.py')
-rw-r--r--pyaggr3g470r/feedgetter.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/pyaggr3g470r/feedgetter.py b/pyaggr3g470r/feedgetter.py
index 0926aa99..eee9ea2b 100644
--- a/pyaggr3g470r/feedgetter.py
+++ b/pyaggr3g470r/feedgetter.py
@@ -64,9 +64,14 @@ class FeedGetter(object):
feedparser.USER_AGENT = conf.USER_AGENT
if conf.HTTP_PROXY == "":
self.proxy = urllib2.ProxyHandler({})
+ self.proxies = {}
else:
self.proxy = urllib2.ProxyHandler({"http" : conf.HTTP_PROXY, \
"https": conf.HTTP_PROXY})
+ self.proxies = {
+ "http": "http://" + conf.HTTP_PROXY,
+ "https": "http://" + conf.HTTP_PROXY
+ }
feedparser.USER_AGENT = conf.USER_AGENT
self.user = models.User.objects(email=email).first()
@@ -105,7 +110,7 @@ class FeedGetter(object):
nice_url = article.link.encode("utf-8")
try:
# resolves URL behind proxies (like feedproxy.google.com)
- r = requests.get(article.link, timeout=2.0)
+ r = requests.get(article.link, timeout=2.0, proxies=self.proxies)
nice_url = r.url.encode("utf-8")
except Timeout:
pyaggr3g470r_log.warning("Timeout when getting the real URL of %s." % (article.link,))
bgstack15