Can you recommend a feed generator library for Python? I could build the XML myself, but I'm looking for a recommended library that is built from the ground up around the RSS (or Atom) spec.
I can recommend that you use PyRSS2Gen [1]. I've used it before and it's really simple and effective
[1] http://www.dalkescientific.com/Python/PyRSS2Gen.htmlI haven't used them myself, but these exist:
[1] http://www.dalkescientific.com/Python/PyRSS2Gen.htmlAccording to http://trac.defuze.org/wiki & http://trac.defuze.org/wiki/atomixlib: atomxlib [1] is "deprecated in favor of the more generic bridge [2]".
So knowing that atomxlib is no longer updated, the choice (for me) is now between PyRSS2Gen [3] and a generic XML library [4] (but not necessarily bridge).
[1] http://trac.defuze.org/wiki/atomixlibWebHelpers has a feedgenerator [1] class.
[1] http://sluggo.scrapping.cc/python/WebHelpers/modules/feedgenerator.htmlYou can use my dict2rss Library to create a RSS-Feed from JSON/DICT Hashes.
http://pastebucket.de/paste/749ce8de << Download this python-Modul and save it in your Python-Path. (Use dict2rss as Filename)
The Syntax is very easy. Justuse this bunch of code.
#!/usr/bin/python
import dict2rss
my_feed_data = {
'title': 'My feed',
'item':{
'a': {
'description':'Hello&World;',
'content':'This is a sample Content',
'comment': "This is a comment",
'pubDate':'18 GMT 1202389 2010',
},
'b': {
'description':'Second Item',
'content':'I love dict2rss.py',
},
},
'version':'0.1',
}
d = dict2rss(my_feed_data)
d.PrettyPrint()
You should now get the following Output in XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<rss version="0.1">
<channel>
<title>My feed</title>
<link></link>
<description>a mapped dict2rss</description>
<language>en-en</language>
<item>
<content>This is a sample Content</content>
<!-- This is a comment -->
<description>Hello&World</description>
<pubDate>18 GMT 1202389 2010</pubDate>
</item>
<item>
<content>I love dict2rss.py</content>
<description>Second Item</description>
</item>
</channel>
</rss>
Quite a late contribution but I'd personally recommend this http://pypi.python.org/pypi/feedgenerator