Michal Čihař - Pinging blog indexing services

Pinging blog indexing services

When I noticed that something like indexing services for blogs exists, I hacked simple dog command to download ping page. This worked more or less, but it didn't gave me any feedback. Today I decided it's time to switch to something more sophisticated.

As most (if not all) services are using XML-RPC with same functions, implementing this in python using xmlrpclib was quite easy. After few minutes reading documentation I had working code which can be attached to publish command in nanoblogger:

import xmlrpclib
import sys

def do_ping(url):
    print "Pinging %s ... " % url,
    sys.stdout.flush()
    try:
        s = xmlrpclib.ServerProxy(url)
        r = s.weblogUpdates.ping("Nijel's Weblog", "http://blog.cihar.com/")
        if r['flerror']:
            print "FAILED"
            print " error: %s" % r['message']
        else:
            print "ok"
        sys.stdout.flush()
    except Exception,v:
        print "FAILED"
        print " error: %s" % str(v)

do_ping("http://ping.blo.gs/")

I'm only affraid that ping services don't like me much now as during testing I produced lots of pings :-).

New Comment

You can not add new comments to old blog posts.