Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #70635

Re: feedparser error

From Kushal Kumaran <kushal.kumaran@gmail.com>
Subject Re: feedparser error
References <4f7cfadc-6b9b-488a-b2cd-b90dd53acbfc@googlegroups.com>
Date 2014-04-26 22:17 +0530
Newsgroups comp.lang.python
Message-ID <mailman.9521.1398530898.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

tad na <teddybubu@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

feedparser error tad na <teddybubu@gmail.com> - 2014-04-25 19:16 -0700
  Re: feedparser error Kushal Kumaran <kushal.kumaran@gmail.com> - 2014-04-26 22:17 +0530
  Re: feedparser error MRAB <python@mrabarnett.plus.com> - 2014-04-26 17:55 +0100
    Re: feedparser error tad na <teddybubu@gmail.com> - 2014-04-26 12:22 -0700

csiph-web