Ping... Ping...

This is not new stuff people. Back in 2003 I was wanting to set up some type of ping thing. That was before I had signed up with Technorati and it may not have even existed yet. (I'm too lazy to check. Someone else will know. OK, I'm not too lazy to check. My anal retentive perfectionist beat up my inner sloth. Archive.org has records of Technorati back to 2002. Moving on....)

So, prompted by Jeneane— who always has more energy than me and who just sent me an email kicking my slothful behind for not having pinged Technorati in, like three centuries, and she even asked Kevin about it, so now the embarrassing truth is out in the upper echelons of the Technorati elite— I have written a script to ping Technorati when my weblogs update. As I write this I have not tested it, but when I publish this post I will know if my crappy Python hacking skillz are worth anything.

Even though it's been done before, I'm sure, here is some code you can use in Python to do the same:

import httplib sData = '<?xml version="1.0"?>\n' sData = sData + '<methodCall>\n' sData = sData + ' <methodName>weblogUpdates.ping</methodName>\n' sData = sData + ' <params>\n <param>\n' sData = sData + ' <value>'+blog_name+'</value>\n' sData = sData + ' </param>\n <param>\n' sData = sData + ' <value>'+url+'</value>\n' sData = sData + ' </param>\n </params>\n<methodCall>' h = httplib.HTTP('rpc.technorati.com') h.putrequest('POST', '/rpc/ping') h.putheader('User-Agent', 'JNGM Pinger') h.putheader('Host', 'rpc.technorati.com') h.putheader('Content-Type', 'text/xml') h.putheader('Content-length', '250') h.endheaders() h.send(sData)

This code snippet runs in the middle of a script I have called update.py which slurps a text file into my weblog database and posts the new article. Now you know. Wasn't that exciting?

Now I just need to figure out how to do that new-fangled tagging thing all the kids are doing these days. Crazy kids. (Shakes cane).

Woohoo! We're pinging left, right, and center over here.

[Link] Comments: [0] Project: [Homegrown Blogging]