fettig.netBlog2002 → A Python library for working with messages

A Python library for working with messages

Wari figures out how Hep and PyBlosxom are similar: they’re both Python apps that deal with reading, storing, and editing messages that live in files.


So they could both use a common library for handling the nitty-gritty of parsing and generating files.  Moreover this library could provide a way to get generic Message objects out of many of the common formats for storing messages, including:

  • RSS (0.9.x, 1.0, 2.0)

  • maildir

  • mbox

  • blosxom-style text files

Having such a library would make it easier to write weblog tools, RSS aggregators, conversion utilities, and PIMs in Python. 


Then I’d like to write another library sits on top of the first.  This second library would (optionally?) use Twisted to provide asynchronous network operations, and give you the ability to access:

  • RSS/maildir/mbox files on FTP and web servers

  • Weblogs through the Blogger and MetaWeblog APIs

  • Advogato diaries

  • IMAP mailboxes

With such a library, it would be really easy to work with messages in Python without worrying about the underlying protocols involved.  For example, you could copy the contents of an RSS feed to a weblog like so:

store1 = openMessageStore("http://www.mysite.com/rss.xml")

store2 = openMessageStore("blogger://username:password@plant.blogger.com/RPC2/MyBlogID")

for messageNo in range(store1.messageCount):

message = store1.getMessage(messageNo)

store2.appendMessage(message)

A lot of the code to build these libraries is already in Hep.  Probably the most important thing at this point is coming up with nice APIs that will work accross many different message formats, and that other programmers will find easy to use.  I started working on a set of such interfaces last night.  If I have time later today I’ll post what I’ve done so far.

Comments are closed.