Ping search engines via RPC in python
October 8, 2009 | pythonauthor: Karol Zielinski | comments: 1 | views: 1463
Tags: ping, pingomatic, python, rpc, search engine, xml-rpc
It’s always good idea to update different search engines that your blog or a websites has updated. The easiest possible way to do this is by pinging them via XML-RPC.
In python there is a great library called xmlrpclib, which will do it for us.
I will translate how it works on my site en.tspot.pl. I will ping pingomatic, which will send a ping to all the search engines.
So…
cd /home/workspace/tspot vim main/models.py
and in class News (which is representation of news table in my database) I added method ‘save()’.
def save(self):
super(News, self).save()
from xmlrpclib import ServerProxy
server = ServerProxy('http://rpc.pingomatic.com/')
try:
server.weblogUpdates.ping('en.tspot.pl', 'http://en.tspot.pl/')
except:
pass
Ready.
Now, I just need to do some changes in existing newses or add new post… after that all the search engines will know about my updates.
Hello, I'm Karol Zielinski, internet evangelist, an entrepreneur, project manager and a web developer from Gdynia, Poland. I like creative design, good advertisement, social media and all kind of stuff around the web.
January 19, 2010, 5:16 pm
thanks for this code