Welcome, guest | Sign In | My Account | Store | Cart

Technocrati (http://www.technorati.com/) maintains a list of blogs tagged with user specified tags. People can submit their blogs for inclusion in Technocrati by using their RPC ping service at http://www.technorati.com/ping. This piece of code allows you ping Technocrati with blog details through a script.

Python, 65 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/python
#
# Written by Mayuresh at gmail dot com
#
# This program posts a blog URL to the Technorati ping server

import xmlrpclib
import socket
import sys
from optparse import OptionParser

TECHNORATI_RPC_PING_SERVER = 'http://rpc.technorati.com/rpc/ping'

usage = """ %prog Blog_name Blog_URL

        Example: %prog YourBlogName http://www.YOURWEBLOGURL.com/
        """
parser = OptionParser(usage=usage)
(options, args) = parser.parse_args()

if len(args) != 2:
        parser.error("Invalid options")

print "Submitting the following blog info to %s" % TECHNORATI_RPC_PING_SERVER
print
print "Blog name: %s" % args[0]
print "Blog URL: %s" % args[1]
print
print "Waiting for server response ..."
print

reply = {}

try:
        s = xmlrpclib.Server(TECHNORATI_RPC_PING_SERVER)
        reply = s.weblogUpdates.ping(args[0], args[1])

except socket.error, msg:
        reply['flerror'] = True
        errCode, reply['message'] = msg

except xmlrpclib.ProtocolError, inst:
        reply['flerror'] = True
        reply['message'] = "Error [%s: %s] occured while accesing url %s" %(inst.errcode, inst.errmsg, inst.url)

except xmlrpclib.Fault, inst:
        reply['flerror'] = True
        reply['message'] = inst.faultString

except:
        reply['flerror'] = True
        reply['message'] = "Unknown error occured"

if reply['flerror']:
        print "The server returned an error"
else:
        print "The server returned success"

print
print "Message from the server: %s" % reply['message']

if reply['flerror']:
        sys.exit(1)
else:
        sys.exit()

Getting you blog listed at Technocrati could increase the chances of ppl reading your blog.

Using the script you could set up a cron job to automatically submit your blog to Technocrati on a daily or weekly basis, thus listing your new blog postings on Technocrati.

I have just started programming in Python and become a fan of the language. Just wrote this program to demonstrate how easy it is to write code to perform useful tasks in Python.

Ping-o-matic (http://pingomatic.com/) allows pinging multiple sites with a blog URL. Something similiar to Ping-o-matic could be build by using such scripts.

Note: The author is in no way affiliated with Technocrati and Ping-o-matic.

1 comment

aler saert 16 years, 1 month ago  # | flag

imho. Very interesting post. I am use this in the work http://www.atakamus.com/music/