Syndication feeds from templates
Posted by David Zaslavsky on — EditedOne of the must-have necessities for any blogging or other web publishing software is the RSS (Really Simple Syndication) feed. RSS, or its younger and sexier sibling Atom, is the file format used by news aggregators, which give you a frequent listing of posts and stories published by your favorite blogs, newspapers, journals, whatever you want, without you having to actually go to their website. Usually the RSS feed is generated by some library of code where you construct your feed as an array of objects or data structures. Here's how you put together an RSS feed with PyRSS2Gen, for instance:
rss = PyRSS2Gen.RSS2(
title = "Andrew's PyRSS2Gen feed",
link = "http://www.dalkescientific.com/Python/PyRSS2Gen.html",
description = "The latest news about PyRSS2Gen, a Python library for generating RSS2 feeds",
lastBuildDate = datetime.datetime.now(),
items = [
PyRSS2Gen.RSSItem(
title = "PyRSS2Gen-0.0 released",
link = "http://www.dalkescientific.com/news/030906-PyRSS2Gen.html",
description = "Dalke Scientific today announced PyRSS2Gen-0.0, a library for generating RSS feeds for Python. ",
guid = PyRSS2Gen.Guid("http://www.dalkescientific.com/news/030906-PyRSS2Gen.html"),
pubDate = datetime.datetime(2003, 9, 6, 21, 31)),
PyRSS2Gen.RSSItem(
title = "Thoughts on RSS feeds for bioinformatics",
link = "http://www.dalkescientific.com/writings/diary/archive/2003/09 …