Announcing,, and

Steve R. Hastings steve at
Wed Mar 8 02:22:03 CET 2006

I have written some Python library modules to help with creating Atom
syndication feeds.  Originally, I had a single module called "PyAtom"; now
I have split it up into three modules:,, and

You can download these modules from here:

I wrote these because I wanted a really easy, Pythonic way to create Atom
syndication feeds.  Here is a bit of sample code from the self-test at the
end of

-- cut here -- cut here -- cut here -- cut here -- cut here --
    # Test: generate the "Atom-Powered Robots Run Amok" example
    # Note: the original had some of the XML declarations in
    # a different order than atomfeed puts them.  I swapped around
    # the lines here so they would match the atomfeed order.  Other
    # than that, this is the example from:

    s_example = """\
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="">
    <title>Example Feed</title>
        <name>John Doe</name>
    <link href=""/>
        <title>Atom-Powered Robots Run Amok</title>
        <link href=""/>
        <summary>Some text.</summary>

    xmldoc, feed = new_xmldoc_feed()

    feed.title = "Example Feed" = "urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6"
    feed.updated = "2003-12-13T18:30:02Z"

    link = Link("")

    author = Author("John Doe")

    entry = Entry()
    feed.entries.append(entry) = "urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a"
    entry.title = "Atom-Powered Robots Run Amok"
    entry.updated = "2003-12-13T18:30:02Z"
    entry.summary = "Some text."

    link = Link("")

    s = str(xmldoc)
    if s_example != s:
        failed_tests += 1
        print "test case failed:"
        print "The generated XML doesn't match the example.  diff follows:"
        print diff(s_example, s)
-- cut here -- cut here -- cut here -- cut here -- cut here --

I welcome any feedback on these.
Steve R. Hastings    "Vita est"
steve at

More information about the Python-list mailing list