feedparser error

Kushal Kumaran kushal.kumaran at gmail.com
Sat Apr 26 12:47:57 EDT 2014


tad na <teddybubu at gmail.com> writes:

> python 2.7.2
>
> The following code has an error and I can not figure out why:
>
> import feedparser
> d = feedparser.parse('http://bl.ocks.org/mbostock.rss')
> numb = len(d['entries'])
> for post in d.entries:
>     print post.pubDate+"\n"
>
> -----------------------------------
> the error is :
>
>     print post.pubDate+"\n"
>   File "build\bdist.win32\egg\feedparser.py", line 416, in __getattr__
>     raise AttributeError, "object has no attribute '%s'" % key
> AttributeError: object has no attribute 'pubDate'
>
> -----------------------------------
>
> The only thing I can think of is feedparser does not like uppercase(pubDate)?????
> I can not change someone else's rss.   What can I do here?

You want post.published, or post.published_parsed.  See the feedparser
documentation here:
https://pythonhosted.org/feedparser/reference-entry-published.html

-- 
regards,
kushal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20140426/2ed1499d/attachment.sig>


More information about the Python-list mailing list