Busy making things: github, links, photos, @mc.

tblib 0.1.0 Released!

Posted: January 30th, 2003 | Author: | Filed under: Projects, Python | Comments Off

I managed to pick up tblib this evening and start working on it again.  I implemented some basic error checking and autodiscovery.  (Yay!)  The previous version of tblib would just consume the XML that resulted from a trackback ping.  Now it parses the xml with a really simple regular expression (thanks Steve!).  If it was a successful ping, self.tbErrorCode will be 0 (which is a good thing) and self.tbErrorMessage will be None.  If something went wrong, self.tbErrorCode will be 1 and self.tbErrorMessage will hopefully help you a bit.

Here’s an example for you:

>>> import tblib
>>> tb = tblib.TrackBack()
>>> tb.autodiscover('http://Queue/weblog/matt/archives/2003_01.html#000007')
>>> print tb.tbUrl
http://Queue/weblog/mt-tb.cgi/7
>>> tb.blog_name = 'My Weblog'
>>> tb.title = 'This Post Will Ping That Weblog Entry'
>>> tb.url = 'http://postneo.com'
>>> tb.excerpt = 'I released tblib 0.1.0 today.  It supports autodiscovery...'
>>> tb.ping()
>>> print tb.tbErrorCode
0

Here’s the source: tblib-0.1.0.py.txt.  To use it, save it (as tblib.py) to a directory, create a script in that directory, and put import tblib at the top.  It doesn’t use anything bleeding edge, but I’m pretty sure you’ll need Python 2.x.  See my original tblib weblog post for additional info.  It is currently licensed under the GPL, though if that is stopping you from including it in your project, email me and I can dual-license it or something.  Also use that email link to send me any questions or comments.

Eventually, I’ll code a setup script for tblib, and I still owe you a command line trackback client using tblib.


Comments are closed.