top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Downloading the feed using feedparser in python

+2 votes
413 views

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'"**********-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
posted Sep 4, 2013 by Sheetal Chauhan

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+1 vote

I want to find the maximal number of elements contained in a nested dictionary, e.g.

data = {
 'violations':
 {
 'col1': {'err': [elem1, elem2, elem3]},
 'col2': {'err': [elem1, elem2]}
 }
 }

so to find the maximal number of elements in the lists for key 'err' in key 'col1' and 'col2'. Also key 'violations' may contain many keys (e.g. 'col1' , 'col2', 'col3' etc), so what's the best way to do this (using a loop)?

max = 0for col in data.violations:
 if max < len(data.violations.col.err):
 max = len(data.violations.col.err)
+2 votes

As per my understanding Receive system calls will be a blocking call of the code... it will not go ahead unless it receives the response from client .. my question is how would i set time in that? i want my code should wait only for few seconds then it has to come out from that

+1 vote

I'm trying to work through Skienna's algorithms handbook, and note that the author often uses graphical representations of the diagrams to help understand (and even debug) the algorithms. I'd like to reproduce this in python.

How would you go about this? pyQt, pygame and pyglet immediately come to mind, but if I go that route the number of people that I can share my work with becomes quite limited, as compared to the portability of javascript projects.

I guess my question really is: has anyone had success creating an interactive graphical project in the browser using python?

0 votes

Does any one have a good solution for how to embed the output of a subprocess (ex. subprocess.Popen("htop", stdout=subprocess.PIPE)) into an ncurses window? So for example, the terminal window is broken up into quadrants and the top right has htop running inside. I'd imagine this would involve some kind of terminal emulation as the dimensions of the window would need to be queried by htop.

...