Downloading the feed using feedparser

mukesh tiwari mukeshtiwari.iiitm at gmail.com
Wed Sep 4 07:12:09 EDT 2013


Hello all,
I am trying to download the feed of http://blogs.forrester.com/feed but I am stuck with a problem. 

>>> import feedparser
>>> d = feedparser.parse('http://blogs.forrester.com/feed')
>>> d.etag
u'"1378291653-1"'
>>> d.modified
'Wed, 04 Sep 2013 10:47:33 +0000'

>>> feedparser.parse('http://blogs.forrester.com/feed', etag=d.etag, modified=d.modified).status
200

When I am running this, should not this be 304 ( The content can't be change so fast in a moment or this server is not configured properly ). If I rely on this then whenever I run the code, I will download the content irrespective of content changed or not. Could some one please suggest me how to avoid the duplicate download ? 

The below one is working fine so if I try to download again then I will get 304 response since no data is changed on server.

>>> d = feedparser.parse("feed://feeds.huffingtonpost.com/HP/MostPopular")
>>> d.etag
u'Vx5oxwMUzEFvFpd6BNR23912Zk4'
>>> d.modified
'Wed, 04 Sep 2013 10:32:06 GMT'
>>> feedparser.parse("feed://feeds.huffingtonpost.com/HP/MostPopular", etag= d.etag, modified=d.modified).status
304

Thank you
Mukesh Tiwari



More information about the Python-list mailing list