In addition to the pingback library that I built earlier today, I decided to add Trackback support to my weblog software as well. To that end, I’ve created a new trackback.py library which handles the grunt work of being a Trackback client. It’s not exactly very difficult, anyways. The method of greatest concern for a client:
def ping(trackbackURI, sourceURI, title = None, excerpt = None, siteName = None): """Implements a trackback ping. This method throws exceptions based upon the error returned from the trackback server, unless it is the successful error code '0'. The excerpt parameter should contain plaintext for maximum readability on trackback servers. Providing HTML is not recommended. This library provides a function ``detagHTML`` which will shred HTML text for you.""" ...
This library does not offer support for being a Trackback server, nor autodiscovery in any way. I do not believe that the autodiscovery method suggested by the Trackback specification is appropriate. Embedding RDF data in an HTML comment? This is the kind of thing a perl author would suggest, since they believe they could could regex their way out of the hole they dug for themselves. I don’t like it.
An alternative implementation of trackback in Python is available called tblib. I chose to write my own library because:
- I was bored at work,
- I didn’t want to use a GPL-licensed library in my modified-BSD licensed weblog,
- I didn’t like the way tblib used regular expressions to grab data from ping responses rather than using an XML parser,
- I didn’t want to implement autodiscovery in a flappy regex perl way. (No disrespect meant towards the author of tblib, of course. I realize that there is no simpler or stronger way to do Trackback autodiscovery.)