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:
- tblib-0.2.0: Current release. David Edmondson fixed a major bug in autodiscovery. Thanks!
- tblib-0.1.0: Archived. A Highlighted version (thanks to GNU Source-highlight) is also available.
- tblib-0.0.4: Archived, first public version.
- tblib-0.0.2: Archived, hard coded goodness, really ugly code.
tbclient Downloads:
- tbclient-0.0.2: Initial release, it works quite well. No autodiscovery yet, but stay tuned. A highlighted version is also available. Go source-highlight, go!
Release History:
- 0.2.0: 9/05/03 - Fix to autodiscover() thanks to dme. It now properly finds tburl in an archive page. (previously it would incorrectly return the first tbUrl found.)
- 0.1.0: 1/29/03 - Code cleanup, release. It can send pings, and autodiscover a URL to ping.
- 0.0.9: 1/29/03 - Basic error handling and autodiscovery works!
- 0.0.7: 1/29/03 - Got lost in the shuffle, error handling worked, autodiscovery did not.
- 0.0.5: 1/29/03 - Internal development version. Working on autodiscovery and error handling.
- 0.0.4: 1/22/03 - First public release, code cleanup.
- 0.0.3: 1/22/03 - Removed hard coding that was used for testing.
- 0.0.2: 1/21/03 - First working version.
- 0.0.1: 1/21/03 - Initial version. Thanks to Mark Pilgrim for helping me figure some module basics out.
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.