473,602 Members | 2,792 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 1155

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
1396
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
2577
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
1990
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
1066
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
1296
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
1850
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
1537
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
1536
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
2576
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
7993
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
7920
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8404
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8054
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8268
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
6730
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...
0
5440
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
3900
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.