~cedric/newspipe

599a2f74e489c7d9a7cda0078b066e594912ee69 — Cédric Bonhomme 7 years ago bbab44e
It is now possible to set the user-agent used by the feed parser.
3 files changed, 16 insertions(+), 11 deletions(-)

M source/cfg/pyAggr3g470r.cfg-sample
M source/conf.py
M source/feedgetter.py
M source/cfg/pyAggr3g470r.cfg-sample => source/cfg/pyAggr3g470r.cfg-sample +5 -3
@@ 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

M source/conf.py => source/conf.py +7 -5
@@ 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

M source/feedgetter.py => source/feedgetter.py +4 -3
@@ 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