should use a standard python-feedparser or embed the patched one

Bug #716446 reported by Vincent Ladeuil
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
bzr-website
Fix Released
High
Richard Wilbur

Bug Description

I can't run 'python build.py' locally, it fails with:

fetching data from http://feeds.launchpad.net/bazaar/announcements.atom
Traceback (most recent call last):
  File "build.py", line 121, in <module>
    main()
  File "build.py", line 107, in main
    build_feed("Community News", NEWS_RSS, 4),
  File "build.py", line 63, in build_feed
    d = feedparser.parse(rss_url, extra_headers={'Cache-control': 'max-age=60'})
TypeError: parse() got an unexpected keyword argument 'extra_headers'

The backtrace points to build_feed and there we have:

    # we use our own copy of feedparser with a patch to let
    # <http://code.google.com/p/feedparser/issues/detail?id=224> extra_headers
    # be passed
    d = feedparser.parse(rss_url, extra_headers={'Cache-control': 'max-age=60'})

Nice !

But... can I have this feedparser too ?

I'm on maverick (python-feedparser 4.1-14) and I wonder what is used in production...

Related branches

Revision history for this message
Vincent Ladeuil (vila) wrote :

I worked around the problem with:

=== modified file 'build.py'
--- build.py 2011-02-08 12:20:55 +0000
+++ build.py 2011-02-10 14:23:45 +0000
@@ -60,7 +60,7 @@
     # we use our own copy of feedparser with a patch to let
     # <http://code.google.com/p/feedparser/issues/detail?id=224> extra_headers
     # be passed
- d = feedparser.parse(rss_url, extra_headers={'Cache-control': 'max-age=60'})
+ d = feedparser.parse(rss_url)
     entries = []
     for entry in d.entries[0:count]:
         entries.append(dict(

Changed in bzr-website:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Martin Pool (mbp) wrote :

As the google bug says, the code is in <https://code.launchpad.net/~mbp/feedparser/224-headers/>

The easiest thing for you is probably to run from a checkout of that branch, and/or to pass the header value conditionally on checking the feedparser version.

I think including a snapshot of feedparser will just make things worse.

Revision history for this message
Martin Pool (mbp) wrote :

I don't think we should actually change the bzr-website scripts for this, other than perhaps to mention where the branch is.

Changed in bzr-website:
status: Confirmed → Invalid
Revision history for this message
Роман Донченко (dpb-r) wrote :

The recent versions of feedparser include this functionality out of the box, so the custom branch is no longer needed. The interface is slightly different:

=== modified file 'build.py'
--- build.py 2012-03-21 10:29:44 +0000
+++ build.py 2012-05-13 23:53:34 +0000
@@ -57,10 +57,7 @@

 def build_feed(title, rss_url, count):
     print "fetching data from %s" % (rss_url,)
- # we use our own copy of feedparser with a patch to let
- # <http://code.google.com/p/feedparser/issues/detail?id=224> extra_headers
- # be passed
- d = feedparser.parse(rss_url, extra_headers={'Cache-control': 'max-age=60'})
+ d = feedparser.parse(rss_url, request_headers={'Cache-control': 'max-age=60'})
     entries = []
     for entry in d.entries[0:count]:
         entries.append(dict(

Changed in bzr-website:
status: Invalid → New
Changed in bzr-website:
status: New → Triaged
assignee: nobody → Richard Wilbur (richard-wilbur)
status: Triaged → In Progress
Revision history for this message
Richard Wilbur (richard-wilbur) wrote :

Ran into this while working on lp:963742.

Anybody know what triggers a rebuild of the Bazaar home page (index.html)?

Changed in bzr-website:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.