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


Groups > comp.lang.python > #70620 > unrolled thread

feedparser error

Started bytad na <teddybubu@gmail.com>
First post2014-04-25 19:16 -0700
Last post2014-04-26 12:22 -0700
Articles 4 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  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

#70620 — feedparser error

Fromtad na <teddybubu@gmail.com>
Date2014-04-25 19:16 -0700
Subjectfeedparser error
Message-ID<4f7cfadc-6b9b-488a-b2cd-b90dd53acbfc@googlegroups.com>
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?

[toc] | [next] | [standalone]


#70635

FromKushal Kumaran <kushal.kumaran@gmail.com>
Date2014-04-26 22:17 +0530
Message-ID<mailman.9521.1398530898.18130.python-list@python.org>
In reply to#70620

[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

[toc] | [prev] | [next] | [standalone]


#70636

FromMRAB <python@mrabarnett.plus.com>
Date2014-04-26 17:55 +0100
Message-ID<mailman.9522.1398531344.18130.python-list@python.org>
In reply to#70620
On 2014-04-26 03:16, tad na wrote:
> 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?
>
Print dir(post) to see what attributes it has.

[toc] | [prev] | [next] | [standalone]


#70638

Fromtad na <teddybubu@gmail.com>
Date2014-04-26 12:22 -0700
Message-ID<b6bcc4b4-c7fd-4571-9e09-3a4da0489f18@googlegroups.com>
In reply to#70636

You guys are good. thanks.



=======================================
On Saturday, April 26, 2014 11:55:35 AM UTC-5, MRAB wrote:
On 2014-04-26 03:16, tad na wrote:

 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?
Print dir(post) to see what attributes it has.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web