aboutsummaryrefslogtreecommitdiff
path: root/source/feedgetter.py
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-08-11 14:41:59 +0200
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-08-11 14:41:59 +0200
commit3ff281867dd8d6436406616b12f640ebbbb0fd12 (patch)
tree69090e985a9e0b4e1d3c42199c77e9fae3767561 /source/feedgetter.py
parentIt is now possible to fetch articles with feedparser through a HTTP proxy, fo... (diff)
downloadnewspipe-3ff281867dd8d6436406616b12f640ebbbb0fd12.tar.gz
newspipe-3ff281867dd8d6436406616b12f640ebbbb0fd12.tar.bz2
newspipe-3ff281867dd8d6436406616b12f640ebbbb0fd12.zip
proxy object is now instancied in the __init__ function of feedgetter class.
Diffstat (limited to 'source/feedgetter.py')
-rwxr-xr-xsource/feedgetter.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/source/feedgetter.py b/source/feedgetter.py
index cec74938..24d0640c 100755
--- a/source/feedgetter.py
+++ b/source/feedgetter.py
@@ -66,6 +66,10 @@ class FeedGetter(object):
# MongoDB connections
self.articles = mongodb.Articles(conf.MONGODB_ADDRESS, conf.MONGODB_PORT, \
conf.MONGODB_DBNAME, conf.MONGODB_USER, conf.MONGODB_PASSWORD)
+ if conf.HTTP_PROXY == "":
+ self.proxy = urllib.request.ProxyHandler({})
+ else:
+ self.proxy = urllib.request.ProxyHandler({"http":conf.HTTP_PROXY})
def retrieve_feed(self, feed_url=None, feed_original=None):
"""
@@ -110,11 +114,7 @@ class FeedGetter(object):
"""
Add the articles of the feed 'a_feed' in the SQLite base.
"""
- if conf.HTTP_PROXY == "":
- proxy = urllib.request.ProxyHandler({})
- else:
- proxy = urllib.request.ProxyHandler({"http":conf.HTTP_PROXY})
- a_feed = feedparser.parse(feed_link, handlers = [proxy])
+ a_feed = feedparser.parse(feed_link, handlers = [self.proxy])
if a_feed['entries'] == []:
return
try:
bgstack15