Skip to content

Instantly share code, notes, and snippets.

@uGeek
Forked from martg0/pyrss2gen-example.py
Last active October 8, 2019 19:27
Show Gist options
  • Save uGeek/8016ba1a1c263fb663dfa283c2b311f3 to your computer and use it in GitHub Desktop.
Save uGeek/8016ba1a1c263fb663dfa283c2b311f3 to your computer and use it in GitHub Desktop.
PyRSS2Gen example
#"""
#example of the usage of pyrss2gen library.
#URL: http://www.dalkescientific.com/Python/PyRSS2Gen.html
# Install: pip3 install pyrss2gen
# Exec: python3 pyrss2gen.py
#"""
import datetime
import PyRSS2Gen
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/06/RSS.html",
description = "One of the reasons I wrote PyRSS2Gen was to "
"experiment with RSS for data collection in "
"bioinformatics. Last year I came across...",
guid = PyRSS2Gen.Guid("http://www.dalkescientific.com/writings/"
"diary/archive/2003/09/06/RSS.html"),
pubDate = datetime.datetime(2003, 9, 6, 21, 49)),
])
rss.write_xml(open("pyrss2gen.xml", "w"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment