feedparser error

T

tad na

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'
 
K

Kushal Kumaran

tad na said:
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'

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

--
regards,
kushal

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJTW+M9AAoJEKolkdITDqLtVYMH/R4xdWV/lvUcLgZXCcWFvZmd
z/vzDB1aMtnEkCQOdUYWYGVNq6io0RBY3DzvXAkeuxoEFa6lLDRbOf24K/wNTPIj
VqgUTFu7A7F1TV9xowQcPUFp9eP+lt2Zju7OjDO8GjPuqLOh2zpyXyIuLnBWmBOW
9OwAtcfMH7tJkjtVt3TnXG9AU6JgGpOTKRHYgmm+FFXvwYtBXEoLp9iTRJ8HV4Yj
ImLCuFQpRUz1Om932QcvLIMwdFsAu3KMRxjR4jYeLbBLmrBirPkLn6iQ/hatgruX
kmFczjkVE/9YQ/XV5FmmSa7lPT3CekZkkTQ+nOO1K0t4bTD1mZ59111xwPCw2p4=
=m78K
-----END PGP SIGNATURE-----
 
M

MRAB

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

tad na

You guys are good. thanks.



=======================================
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'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top