<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Mohanjith&#039;s Blog &#187; Python</title> <atom:link href="http://mohanjith.net/blog/topics/python/feed" rel="self" type="application/rss+xml" /><link>http://mohanjith.net/blog</link> <description>MOHA blogging news and thoughts...</description> <lastBuildDate>Wed, 14 Dec 2011 14:18:18 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Poll-n-Ping, coz u r busy blogging</title><link>http://mohanjith.net/blog/2008/03/poll-n-ping-coz-u-r-busy-blogging.html</link> <comments>http://mohanjith.net/blog/2008/03/poll-n-ping-coz-u-r-busy-blogging.html#comments</comments> <pubDate>Fri, 14 Mar 2008 13:58:00 +0000</pubDate> <dc:creator>S H Mohanjith</dc:creator> <category><![CDATA[Blog]]></category> <category><![CDATA[Ping]]></category> <category><![CDATA[Python]]></category> <category><![CDATA[TurboGears]]></category><guid
isPermaLink="false">http://mohanjith.net/wordpress/?p=54</guid> <description><![CDATA[TweetI would like to introduce a brand new service. It is a automated blog search directory pinging service named Poll-n-Ping. It is different from Ping-o-matic and similar services, because Poll-n-Ping monitors the blog (actually the feed) for changes and when it detects changes it will automatically ping the blog search directories. You can checkout the [...]]]></description> <content:encoded><![CDATA[<p><span
style="float: right; margin: 5px 0px 0px 5px;" ><a
class="twitter-share-button"  data-via="mohanjith" data-count="vertical" data-related="" data-lang="en" data-url="http://mohanjith.net/blog/2008/03/poll-n-ping-coz-u-r-busy-blogging.html" data-text="Poll-n-Ping, coz u r busy blogging" href="http://twitter.com/share?via=mohanjith&#038;count=vertical&#038;related=&#038;lang=en&#038;url=http%3A%2F%2Fmohanjith.net%2Fblog%2F2008%2F03%2Fpoll-n-ping-coz-u-r-busy-blogging.html&#038;text=Poll-n-Ping%2C%20coz%20u%20r%20busy%20blogging" >Tweet</a></span>I would like to introduce a brand new service. It is a automated blog search directory pinging service named <a
href="http://mohanjith.net/pnp">Poll-n-Ping</a>. It is different from <a
href="http://pingomatic.com/">Ping-o-matic</a> and similar services, because Poll-n-Ping monitors the blog (actually the feed) for changes and when it detects changes it will automatically ping the blog search directories.</p><p>You can checkout the service at <a
href="http://mohanjith.net/pnp">http://mohanjith.net/pnp</a>. All this comes free of charge, but donations are always welcome. Right now there is no limit on the number of blogs that can be monitored by a single user. If you want your blog to be submitted to all the blog search directories that we add support from time to time, you will have to visit <a
href="http://mohanjith.net/pnp">Poll-n-Ping</a> regularly.</p><p>Soon I plan to add alert service <a
href="http://mohanjith.net/pnp">Poll-n-Ping</a>, the subscribed users can receive notification mails or IM when content changes, blog goes offline, and/or blog comes online. However this will be a paid service unless I receive enough donations to support the hosting.</p><p><a
href="http://mohanjith.net/pnp">Poll-n-Ping</a> has Turbogears under the hood <img
src='http://cdn.mohanjith.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .</p><p>Hope you will find the <a
href="http://mohanjith.net/pnp">Poll-n-Ping</a> service useful.</p><div
id="fb-like" style=""><iframe
src="http://www.facebook.com/plugins/like.php?href=http://mohanjith.net/blog/2008/03/poll-n-ping-coz-u-r-busy-blogging.html&amp;layout=standard&amp;show_faces=true&amp;width=300&amp;action=like&amp;font=&amp;colorscheme=light&amp;locale=en_US" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:300px; height:30px"></iframe></div>]]></content:encoded> <wfw:commentRss>http://mohanjith.net/blog/2008/03/poll-n-ping-coz-u-r-busy-blogging.html/feed</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Hacking TurboGears: Automatically loggin in users</title><link>http://mohanjith.net/blog/2008/02/hacking-turbogears-automatically-loggin.html</link> <comments>http://mohanjith.net/blog/2008/02/hacking-turbogears-automatically-loggin.html#comments</comments> <pubDate>Tue, 26 Feb 2008 05:31:00 +0000</pubDate> <dc:creator>S H Mohanjith</dc:creator> <category><![CDATA[Python]]></category> <category><![CDATA[TurboGears]]></category><guid
isPermaLink="false">http://mohanjith.net/wordpress/?p=47</guid> <description><![CDATA[TweetI love the way the Drupal handles account activation and password reset. The user just have to click a link that they receive via e-mail, and they are automatically logged in. I wanted to do something similar with one of the applications I&#8217;m developing right now using TurboGears. I thought I would write a new [...]]]></description> <content:encoded><![CDATA[<p><span
style="float: right; margin: 5px 0px 0px 5px;" ><a
class="twitter-share-button"  data-via="mohanjith" data-count="vertical" data-related="" data-lang="en" data-url="http://mohanjith.net/blog/2008/02/hacking-turbogears-automatically-loggin.html" data-text="Hacking TurboGears: Automatically loggin in users" href="http://twitter.com/share?via=mohanjith&#038;count=vertical&#038;related=&#038;lang=en&#038;url=http%3A%2F%2Fmohanjith.net%2Fblog%2F2008%2F02%2Fhacking-turbogears-automatically-loggin.html&#038;text=Hacking%20TurboGears%3A%20Automatically%20loggin%20in%20users" >Tweet</a></span><a
onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.turbogears.org/static/images/g_gear.png"><img
style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 200px;" src="http://www.turbogears.org/static/images/g_gear.png" border="0" alt="TurboGears" /></a><br
/>I love the way the <a
href="http://drupal.org">Drupal</a> handles account activation and password reset. The user just have to click a link that they receive via e-mail, and they are automatically logged in.</p><p>I wanted to do something similar with one of the applications I&#8217;m developing right now using <a
href="http://www.turbogears.org/">TurboGears</a>. I thought I would write a new identity provider, but instead went about hacking TurboGears. I noticed that TurboGears defualt soaprovider can be improved to seperate user authentication and marking a user as authenticated, hence making it reusable.</p><p>In my application&#8217;s controller I use this newly introduced method to mark the user as authenticated. I thought someone else might hit the same problem, and blogged about it.</p><p>You can download the patch from <a
href="http://mohanjith.net/downloads/scripts/python/TurboGears/1.0.4.3/soaprovider.diff">http://mohanjith.net/downloads/scripts/python/TurboGears/1.0.4.3/soaprovider.diff</a>, it is created against TurboGears 1.0.4.3.</p><div
id="fb-like" style=""><iframe
src="http://www.facebook.com/plugins/like.php?href=http://mohanjith.net/blog/2008/02/hacking-turbogears-automatically-loggin.html&amp;layout=standard&amp;show_faces=true&amp;width=300&amp;action=like&amp;font=&amp;colorscheme=light&amp;locale=en_US" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:300px; height:30px"></iframe></div>]]></content:encoded> <wfw:commentRss>http://mohanjith.net/blog/2008/02/hacking-turbogears-automatically-loggin.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Automagically ping blog search engines</title><link>http://mohanjith.net/blog/2008/01/automagically-ping-blog-search-engines.html</link> <comments>http://mohanjith.net/blog/2008/01/automagically-ping-blog-search-engines.html#comments</comments> <pubDate>Wed, 23 Jan 2008 20:50:00 +0000</pubDate> <dc:creator>S H Mohanjith</dc:creator> <category><![CDATA[Blog]]></category> <category><![CDATA[Ping]]></category> <category><![CDATA[Python]]></category><guid
isPermaLink="false">http://mohanjith.net/wordpress/?p=36</guid> <description><![CDATA[TweetI wanted to automatically ping Technorati, Icerocket, and Google Blog Search, that means with no intervention the blog search engines should be pinged. I was alright with a delay of 15 minutes. So I went about exploiting the XML-RPC services provided by the blog search engines. I came up with this python script. I set [...]]]></description> <content:encoded><![CDATA[<p><span
style="float: right; margin: 5px 0px 0px 5px;" ><a
class="twitter-share-button"  data-via="mohanjith" data-count="vertical" data-related="" data-lang="en" data-url="http://mohanjith.net/blog/2008/01/automagically-ping-blog-search-engines.html" data-text="Automagically ping blog search engines" href="http://twitter.com/share?via=mohanjith&#038;count=vertical&#038;related=&#038;lang=en&#038;url=http%3A%2F%2Fmohanjith.net%2Fblog%2F2008%2F01%2Fautomagically-ping-blog-search-engines.html&#038;text=Automagically%20ping%20blog%20search%20engines" >Tweet</a></span>I wanted to automatically ping <a
href="http://www.technorati.com/">Technorati</a>, <a
href="http://www.icerocket.com/">Icerocket</a>, and <a
href="http://blogsearch.google.com/">Google Blog Search</a>, that means with no intervention the blog search engines should be pinged. I was alright with a delay of 15 minutes.</p><p>So I went about exploiting the XML-RPC services provided by the blog search engines. I came up with <a
href="http://mohanjith.net/downloads/scripts/python/xmlrpc-blog-ping.py">this</a> python script. I set up a cron job to invoke the script every 15 minutes. See bellow for the source.</p><pre class="brush: py; ">
#!/usr/bin/python

import xmlrpclib
import urllib2
import os

from hashlib import md5

feed_url = &#039;[Yorur feed url]&#039;
blog_url = &#039;[Your blog url]&#039;
blog_name = &#039;[Your blog name]&#039;
hash_file_path = os.path.expanduser(&quot;~/.blogger/&quot;)

def main():
req = urllib2.Request(feed_url)
response = urllib2.urlopen(req)
feed = response.read()
hash_file_name = hash_file_path + md5(blog_url).hexdigest()

if os.path.exists(hash_file_name):
hash_file = open(hash_file_name, &quot;r+&quot;)
last_digest = hash_file.read(os.path.getsize(hash_file_name))
else:
hash_file = open(hash_file_name, &quot;w&quot;)
last_digest = &#039;&#039;

curr_digest = md5(feed).hexdigest()

if curr_digest != last_digest:
ping = Ping(blog_name, blog_url)
responses = ping.ping_all([&#039;icerocket&#039;,&#039;technorati&#039;,&#039;google&#039;])
hash_file.write(curr_digest)

hash_file.close()

class Ping:
def __init__(self, blog_name, blog_url):
self.blog_name = blog_name
self.blog_url = blog_url

def ping_all(self, down_stream_services):
responses = []

for down_stream_service in down_stream_services:
method = eval(&#039;self._&#039; + down_stream_service)
responses.append(method.__call__())

return responses

def _icerocket(self):
server = xmlrpclib.ServerProxy(&#039;http://rpc.icerocket.com:10080&#039;)
response = server.ping(self.blog_name, self.blog_url)
# print &quot;Icerocket response : &quot; + str(response)
return response

def _technorati(self):
server = xmlrpclib.ServerProxy(&#039;http://rpc.technorati.com/rpc/ping&#039;)
response = server.weblogUpdates.ping(self.blog_name, self.blog_url)
# print &quot;Technorati response : &quot; + str(response)
return response

def _google(self):
server = xmlrpclib.ServerProxy(&#039;http://blogsearch.google.com/ping/RPC2&#039;)
response = server.weblogUpdates.ping(self.blog_name, self.blog_url)
# print &quot;Google blog search response : &quot; + str(response)
return response

main()
</pre><p>When ever the script is invoked it will get the post feed content, and create a md5 hash of it and then compare the hash against the last known hash, if they differ ping the given list of service.</p><p>This is very convenient if you have someplace to run the cron job. Even your own machine is sufficient if you can keep your machine on for at least 15 minutes after the blog post is made.</p><p>To run the script you need to python 2.4 to later and the python package hashlib. Hope you will find this useful.</p><div
id="fb-like" style=""><iframe
src="http://www.facebook.com/plugins/like.php?href=http://mohanjith.net/blog/2008/01/automagically-ping-blog-search-engines.html&amp;layout=standard&amp;show_faces=true&amp;width=300&amp;action=like&amp;font=&amp;colorscheme=light&amp;locale=en_US" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:300px; height:30px"></iframe></div>]]></content:encoded> <wfw:commentRss>http://mohanjith.net/blog/2008/01/automagically-ping-blog-search-engines.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>GNOME Web browser Creative Commons extension</title><link>http://mohanjith.net/blog/2008/01/gnome-web-browser-creative-commons.html</link> <comments>http://mohanjith.net/blog/2008/01/gnome-web-browser-creative-commons.html#comments</comments> <pubDate>Mon, 21 Jan 2008 13:51:00 +0000</pubDate> <dc:creator>S H Mohanjith</dc:creator> <category><![CDATA[Epiphany]]></category> <category><![CDATA[GNOME]]></category> <category><![CDATA[Python]]></category><guid
isPermaLink="false">http://mohanjith.net/wordpress/?p=34</guid> <description><![CDATA[TweetI&#8217;m happy to announce the release of cc-license-viewer 1.1.0 for Epiphany, the GNOME Web browser. It is capable of detecting Creative Commons licensed web pages either with rdf meta data or with the license badge from creativecomons.org and displaying an icon on the status bar. This is a modified version of cc-license-viewer released by Jaime [...]]]></description> <content:encoded><![CDATA[<p><span
style="float: right; margin: 5px 0px 0px 5px;" ><a
class="twitter-share-button"  data-via="mohanjith" data-count="vertical" data-related="" data-lang="en" data-url="http://mohanjith.net/blog/2008/01/gnome-web-browser-creative-commons.html" data-text="GNOME Web browser Creative Commons extension" href="http://twitter.com/share?via=mohanjith&#038;count=vertical&#038;related=&#038;lang=en&#038;url=http%3A%2F%2Fmohanjith.net%2Fblog%2F2008%2F01%2Fgnome-web-browser-creative-commons.html&#038;text=GNOME%20Web%20browser%20Creative%20Commons%20extension" >Tweet</a></span>I&#8217;m happy to announce the release of cc-license-viewer 1.1.0 for Epiphany, the GNOME Web browser. It is capable of detecting <a
href="http://creativecommons.org">Creative Commons</a> licensed web pages either with rdf meta data or with the license badge from creativecomons.org and displaying an icon on the status bar.</p><p>This is a modified version of cc-license-viewer released by <a
href="http://wiki.creativecommons.org/Epiphany_CC_Extension">Jaime Frutos Morales</a>. Jaime Frutos Morales extension is not capable of detecting web pages with the Creative Commons license badge.</p><p>You can download the extension <a
href="http://mohanjith.net/downloads/gnome/epiphany/extensions/cc-license-viewer/cc-license-viewer-1.1.0.tar.gz">cc-license-viewer-1.1.0.tar.gz</a></p><p>Follow the steps bellow to install the extensionn. I&#8217;m assuming you have already installed epiphany and epiphany-extensions.</p><p>Step 1 &#8211; Download the extension archive</p><pre> $ wget http://mohanjith.net/downloads/gnome/epiphany/extensions/cc-license-viewer/cc-license-viewer-1.1.0.tar.gz</pre><p>Step 2 &#8211; Extract the extension archive to epiphany extensions directory</p><pre> $ cd /usr/lib/epiphany/2.20/extensions/ $ tar -xzvf [Location_to_archive] .</pre><p>Step 3 &#8211; Restart epiphany and enable CC extension</p><p>Goto Tools -&gt; Extensions and then select the check box against Creative Commons license viewer.</p><p>Step 4 &#8211; Goto Creative Commons page</p><p>Goto a CC licensed page, e.g. <a
href="http://creativecommons.org">http://creativecommons.org</a></p><p>My next plan would be to extend the functionality of this extension such that more informative icon is shown at the status bar. For the time beign have fun with this extension.</p><div
id="fb-like" style=""><iframe
src="http://www.facebook.com/plugins/like.php?href=http://mohanjith.net/blog/2008/01/gnome-web-browser-creative-commons.html&amp;layout=standard&amp;show_faces=true&amp;width=300&amp;action=like&amp;font=&amp;colorscheme=light&amp;locale=en_US" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:300px; height:30px"></iframe></div>]]></content:encoded> <wfw:commentRss>http://mohanjith.net/blog/2008/01/gnome-web-browser-creative-commons.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: basic (User agent is rejected)
Database Caching 16/19 queries in 0.008 seconds using memcached
Object Caching 0/0 objects using memcached
Content Delivery Network via cdn.mohanjith.net

Served from: mohanjith.net @ 2012-05-30 08:47:39 -->
