473,402 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Announcing atomfeed.py, xmlelements.py, and feedutils.py

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: xmlelements.py, atomfeed.py, and
feedutils.py.

You can download these modules from here:

http://home.blarg.net/~steveha/atomfeed-0.5.0.tar.gz

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 atomfeed.py:

-- 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:
#
# http://www.atomenabled.org/developer...on/#sampleFeed

s_example = """\
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Example Feed</title>
<id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
<updated>2003-12-13T18:30:02Z</updated>
<author>
<name>John Doe</name>
</author>
<link href="http://example.org/"/>
<entry>
<title>Atom-Powered Robots Run Amok</title>
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
<updated>2003-12-13T18:30:02Z</updated>
<link href="http://example.org/2003/12/13/atom03"/>
<summary>Some text.</summary>
</entry>
</feed>"""

xmldoc, feed = new_xmldoc_feed()

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

link = Link("http://example.org/")
feed.links.append(link)

author = Author("John Doe")
feed.authors.append(author)
entry = Entry()
feed.entries.append(entry)
entry.id = "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("http://example.org/2003/12/13/atom03")
entry.links.append(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"
st***@hastings.org http://www.blarg.net/~steveha

Mar 8 '06 #1
1 1138

Steve R. Hastings wrote:
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: xmlelements.py, atomfeed.py, and
feedutils.py.


FWIW, see also Sylvain Hellegouarch's atomixlib [1]. It's used in
production to generate and manage PlanetAtom [2][3].

[1] http://trac.defuze.org/browser/oss/atomixlib
[2] http://planetatom.net/
[3] http://copia.ogbuji.net/blog/2006-01-25/Planet_Ato

--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://fourthought.com
http://copia.ogbuji.net http://4Suite.org
Articles: http://uche.ogbuji.net/tech/publications/

Mar 17 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tim Newsham | last post by:
Announcing: PyGgy v0.3 - http://www.lava.net/~newsham/pyggy/ Tim Newsham 2004 Jul 15 Public Domain ---[ Description PyGgy is a python package for generating parsers and lexers in python.
0
by: dtSearch | last post by:
Press Contact: Belinda Banks S&S Public Relations (212) 946-2823 Belinda@sspr.com Announcing New dtSearch® Product Line Version Release Adds Broader Spider Capabilities to dtSearch Desktop,...
0
by: dtsearch | last post by:
Announcing dtSearch® Product Line Release With New Terabyte Indexer New Version Can Index Over a Terabyte of Text in a Single Index, With Indexed Search Time Typically Under a Second BETHESDA,...
0
by: Mike | last post by:
Announcing MyGeneration (100% Free) MyGeneration is a developer tool that generates code from templates effectively and efficiently by combining a well known scripting engine with a powerful...
0
by: Guest | last post by:
Hi all, great community! Let's say I have the following XML document that I want tofollow: <CallLogs> <Call> <Data> <SubEntry></SubEntry> <SubEntry></SubEntry> <SubEntry></SubEntry>
0
by: YellowFin Announcements | last post by:
Announcing Yellowfin Version 2.4 release. (www.yellowfin.com.au) Existing SQLserver users can take advantage of this upgrade as soon as convenient. V2.4 Exciting changes in the latest...
0
by: Yellowfin Reporting | last post by:
Announcing Yellowfin Version 2.5 upgrade release. (www.yellowfin.com.au) Existing SQLserver based users can take advantage of this upgrade as soon as convenient. Downloads are available through...
0
by: Yellowfin pty ltd | last post by:
Announcing Yellowfin Version 2.5 upgrade release. (www.yellowfin.com.au) Existing DB2 based users can take advantage of this upgrade as soon as convenient. Downloads are available through the...
4
by: Dave | last post by:
Powered by Mod_Python, Switch CSS is a full featured, production ready CSS preprocessor. Some of the features include: - variables - constants - selector prepending: #selector {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.