473,699 Members | 2,230 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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>Exampl e Feed</title>
<id>urn:uuid:60 a76c80-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:12 25c695-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:60a76 c80-d399-11d9-b93C-0003939e0af6"
feed.updated = "2003-12-13T18:30:02Z"

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

author = Author("John Doe")
feed.authors.ap pend(author)
entry = Entry()
feed.entries.ap pend(entry)
entry.id = "urn:uuid:1225c 695-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.app end(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 1169

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
1399
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
2584
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, Network & Web;
0
1993
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, MD (May 24, 2005) dtSearch Corp., a leading supplier of enterprise, end-user and developer text retrieval software, announces Version 7 of its product line. The product line can now instantly search terabytes of text across a desktop, network,...
0
1071
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 database meta-data API. It's 100% FREE: You can use MyGeneration free of charge! The only thing we ask in return is that you provide us with feedback, report any bugs to us, contribute to our site, and spread the word. Most code generators don't...
0
1307
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
1855
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 Yellowfin BI version are set to make the users experience simpler yet more powerful.
0
1541
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 the customer portal. V2.5 The changes in this release significantly enhance our BI and
0
1553
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 customer portal. V2.5 The changes in this release significantly enhance our BI and
4
2578
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
8694
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9182
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8890
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7757
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4634
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2355
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2013
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.