tblib: A TrackBack Library in Python

This is the official page for tblib.  Tblib is a Python library for creating TrackBack pings.  You can take a look at a few weblog entries: first release, 0.1.0 release, command line client release.

Installation is pretty easy right now.  Grab a copy of the source, save it as tblib.py in your working directory.  You can then access it from the interpreter (if you invoke from that directory), or create a new file in that directory.  You can then import tblib and use it from there.

Here's a good usage example (0.1.0 or greater):

>>> 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

I have coded a command line client to illustrate the usage of tblib.  I think that the command line client moves tblib from the 'cool but useless' to the 'actually useful' category.  I have a Radio weblog, though it is not trackback-enabled.  If I really want someone (besides Sam Ruby) to know about something I wrote, I can now ping them manually.  This isn't the way that trackback was intended to be used, but it works. Here's a sample session:

[user @ box tb]$ ./tbclient.py
Usage: tblib <args>
  Valid arguments:
    -tburl foo: ping the trackback url foo
    -title foo: title of your trackback or weblog post
    -excerpt foo: Uses foo as the excerpt to be posted to the trackback
    -url foo: The url to point to (usually the url of the post in which you ref the trackback)
    -blogname foo: The name of your weblog
[user @ box tb]$ ./tbclient.py -tburl
http://Queue/weblog/mt-tb.cgi/7 -title "My Title" -excerpt "My Excerpt" -url http://postneo.com -blogname "My Weblog Name"
Trackback command line client here.  Preparing TrackBack...
TrackBack URL:
http://Queue/weblog/mt-tb.cgi/7
TrackBack Title: My Title
TrackBack Excerpt: My Excerpt
Your URL:
http://postneo.com
Your Weblog Name: My Weblog Name
Pinging
http://Queue/weblog/mt-tb.cgi/7...
HTTP Response: 200 OK
TrackBack Error Code is: 0 (zero is okay)
Done!

tblib Downloads:

tbclient Downloads:

Release History:

This is my first 'real' Python project, so my apologies if anything is not Pythonic.  Several URLs are listed in the source for more information about a specific module that was used.

Feel free to email me with any questions or comments.

tblib is released under the GPL.  Please send email to the address above if you have any questions or concerns about that.

Python Powered