Archive for the ‘python’ Category

Get Twitter on Google Talk!

September 6, 2009

When Twitter had integration with IM, the IM was the only way I used Twitter.  First, the IM  (I use Google Talk) is always running on my computer. And then, logging on to Twitter to post a message and check statuses is such a pain.

I have been itching to get Twitter on my IM and was  porting my twitter friends statuses into  Friendfeed and pushing them to the IM as a workaround.

But since Google App Engine has now brought XMPP to its platform, writing a custom Twitter port on IM couldn’t be easier.

http://twitteresque.appspot.com/ is my application written on Python which brings Twitter to your Google Talk IM.

I used OAuth for the app to get access to Twitter and then a cron job to routinely check messages every hour and post to Twitter. Right now, you can post messages by typing into the chat window directly and fetch records manually by just typing in ‘fetch’.

Getting OAuth working from App Engine was a breeze thanks to these examples given here:

http://apiwiki.twitter.com/OAuth-Examples Especially, http://github.com/tav/tweetapp/tree/master

Advertisements

Solve sudoku puzzles on the cloud

January 5, 2009

I had written a Sudoku puzzle solver in Java some time back. Had some time today and rewrote it in Python so I could deploy it on GAE. The result is Sudoku Ninja.

It can currently solve most of the Hard problems on Web Sudoku.

It also has an API where you can enter the puzzle data as a series of numbers row by row and have ‘0’ in place of unfilled cells and send it as a GET request This returns text with the values filled in accordingly. Example.

Yet another feed aggregator…

December 6, 2008

I like the view of alltop.com because it allows you to scan the feeds very quickly. But I wanted a customizable selection of feeds and so set about writing http://feedsrus.appspot.com/ on Google App Engine.

Thanks to URL Fetch API in google app engine and the Feed Parser library it was really easy to build.

The feed entries are cached in memcache in GAE and refreshed every 30 mins. Because of some limits in the number of cycles a request can use, the current implementation doesn’t scale for more than 9 feeds or so. Planning to fetch 9 at a time and use AJAX to load the rest in bits.

UPDATE: I modified the code to use Google AJAX Feed API and removed the part in the server code where I download the feeds. This means that all the GAE needs to do is maintain the user’s feeds in the data store. And of course, it is fast now.

UPDATE 2:  Feedsrus now has tabs!

feedsrus_ss

Jabber Chat Bot Dictionary Service

September 23, 2008

Ever since I wrote this, I wanted an chat bot which would respond to messages and provide some service. One of my most desired service was to fetch word definitions. An avid user of Google’s define keyword search, I wanted it on a chat window.

Got some free time today and whipped up a dictionary service. With free libraries like xmpppy, pywordnet etc, writing the service was very easy.

Steps:

  1. Created a GMail Id to use as a Jabber Id
  2. Install xmppy and python-jabberbot which is a wrapper over xmpppy which makes it very easy to plug into a Jabber service
  3. Install WordNet for dictionary database
  4. Install PyWordNet which is a python interface for WordNet database
  5. Implement a method starting with bot_ e.g.  ‘bot_define’ so that when the user runs enters ‘define <word>, this method would be invoked and the meanings returned. See python-jabberbot link for more info.

Planning to extend this to put in more services.

Official Python Documentation Revamped

August 19, 2007

I have been looking for some neat Python tutorials and I just find that the tutorial on the official Python site has been revamped making it very readable.

Much love to the Python team 🙂