aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-08-15 00:18:28 +0200
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-08-15 00:18:28 +0200
commit599a2f74e489c7d9a7cda0078b066e594912ee69 (patch)
tree69baab34e242c689757138dd90676005507eaee4
parentUpdated revision number in the Sphinx documentation. (diff)
downloadnewspipe-599a2f74e489c7d9a7cda0078b066e594912ee69.tar.gz
newspipe-599a2f74e489c7d9a7cda0078b066e594912ee69.tar.bz2
newspipe-599a2f74e489c7d9a7cda0078b066e594912ee69.zip
It is now possible to set the user-agent used by the feed parser.
-rwxr-xr-xsource/cfg/pyAggr3g470r.cfg-sample8
-rw-r--r--source/conf.py12
-rwxr-xr-xsource/feedgetter.py7
3 files changed, 16 insertions, 11 deletions
diff --git a/source/cfg/pyAggr3g470r.cfg-sample b/source/cfg/pyAggr3g470r.cfg-sample
index 97993533..f22e2850 100755
--- a/source/cfg/pyAggr3g470r.cfg-sample
+++ b/source/cfg/pyAggr3g470r.cfg-sample
@@ -4,6 +4,10 @@ port = 27017
dbname = bob_pyaggr3g470r
user = bob
password =
+[feedparser]
+http_proxy = 127.0.0.1:8118
+user_agent = pyAggr3g470r (https://bitbucket.org/cedricbonhomme/pyaggr3g470r)
+feed_list = ./var/feed.lst
[mail]
enabled = 0
mail_from = pyAggr3g470r@no-reply.com
@@ -12,6 +16,4 @@ smtp = smtp.example.com
username = your_mail_address@example.com
password = your_password
[misc]
-diaspora_pod = joindiaspora.com
-feed_list = ./var/feed.lst
-http_proxy = 127.0.0.1:8118
+diaspora_pod = joindiaspora.com \ No newline at end of file
diff --git a/source/conf.py b/source/conf.py
index 98aa0d48..1b262927 100644
--- a/source/conf.py
+++ b/source/conf.py
@@ -20,9 +20,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>
__author__ = "Cedric Bonhomme"
-__version__ = "$Revision: 0.1 $"
+__version__ = "$Revision: 0.2 $"
__date__ = "$Date: 2012/04/22 $"
-__revision__ = "$Date: 2012/04/22 $"
+__revision__ = "$Date: 2013/08/15 $"
__copyright__ = "Copyright (c) Cedric Bonhomme"
__license__ = "GPLv3"
@@ -43,6 +43,10 @@ MONGODB_DBNAME = config.get('MongoDB', 'dbname')
MONGODB_USER = config.get('MongoDB', 'user')
MONGODB_PASSWORD = config.get('MongoDB', 'password')
+HTTP_PROXY = config.get('feedparser', 'http_proxy')
+USER_AGENT = config.get('feedparser', 'user_agent')
+FEED_LIST = config.get('feedparser', 'feed_list')
+
MAIL_ENABLED = bool(int(config.get('mail','enabled')))
mail_from = config.get('mail','mail_from')
mail_to = config.get('mail','mail_to')
@@ -50,6 +54,4 @@ smtp_server = config.get('mail','smtp')
username = config.get('mail','username')
password = config.get('mail','password')
-DIASPORA_POD = config.get('misc', 'diaspora_pod')
-FEED_LIST = config.get('misc', 'feed_list')
-HTTP_PROXY = config.get('misc', 'http_proxy')
+DIASPORA_POD = config.get('misc', 'diaspora_pod') \ No newline at end of file
diff --git a/source/feedgetter.py b/source/feedgetter.py
index 24d0640c..a2cdb752 100755
--- a/source/feedgetter.py
+++ b/source/feedgetter.py
@@ -20,9 +20,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>
__author__ = "Cedric Bonhomme"
-__version__ = "$Revision: 1.7 $"
+__version__ = "$Revision: 1.8 $"
__date__ = "$Date: 2010/09/02 $"
-__revision__ = "$Date: 2013/08/11 $"
+__revision__ = "$Date: 2013/08/15 $"
__copyright__ = "Copyright (c) Cedric Bonhomme"
__license__ = "GPLv3"
@@ -70,6 +70,7 @@ class FeedGetter(object):
self.proxy = urllib.request.ProxyHandler({})
else:
self.proxy = urllib.request.ProxyHandler({"http":conf.HTTP_PROXY})
+ feedparser.USER_AGENT = conf.USER_AGENT
def retrieve_feed(self, feed_url=None, feed_original=None):
"""
@@ -219,4 +220,4 @@ if __name__ == "__main__":
# For a blogspot blog:
#feed_getter.retrieve_feed("http://www.blogger.com/feeds/4195135246107166251/posts/default", "http://neopythonic.blogspot.com/feeds/posts/default")
- #feed_getter.retrieve_feed("http://www.blogger.com/feeds/8699431508730375743/posts/default", "http://python-history.blogspot.com/feeds/posts/default")
+ #feed_getter.retrieve_feed("http://www.blogger.com/feeds/8699431508730375743/posts/default", "http://python-history.blogspot.com/feeds/posts/default") \ No newline at end of file
bgstack15