Sunday, May 02, 2010

Google App Engine Twitter Bot

After I became familiar with Python and Google's hosting platform (called App Engine) I decided to write my first app for the platform.

And here it is - a simple Twitter bot which get's shared posts with comments "#twitter" from your Google Reader Atom feed and posts them to your Twitter feed.

*) UPDATE (02 Feb 2011): Since Twitter discontinued the Basic API Access, I modified the bot to use the oAuth Twitter API
I also changed the shorten url service to

Take a look and change the following lines in file accordingly in order to run the app successfully:

# First you need to create an app here
# or
# and get the codes below
# The next codes are found
# right menu, after you clicked on the app
# api keys found at:
# Google reader feed URL
# example is mine below

If you have questions leave your comments below. I will try to help you.

Python 2.6 & Google App Engine

Some of you may know that I am mainly developing on PHP (as a backend language) and MySQL database with different storage engines (XtraDB, InnoDb and PBXT).

A week ago I decided to get involved more deeply into Python and Google App Engine platform. I was already looking into Python as a generic type language for my system administration needs which arised in the last two months.
I know that all (most of) sys-admins use Perl as it is their old-school tool-language, but I wanted something better with easier and cleaner syntax and flexible enough.

So here came Python and it's brief tutorial. I must say it's fabulous and easy to understand.
I recommend you take a look at it (please read it carefully, there is nothing unnecessary written) and also watch some of the Google I/O talks of the Google Python gurus - Guido van Rossum (Pythons creator) and Alex Martelli.

Painless Python part 1 by Alex Martelli
Painless Python part 2 by Alex Martelli

Google App Engine is a new (to me) scalable platform for building web apps and I must say it's very easy for start. You don't have to think about software tuning, optimization, etc. Except of course the optimization algorithms and hints given from Google on how to build a successful app, which are easy to take in account. After you've become familiar with Python you may want to take a closer look at App Engine and the provided Python APIs.
Yes instead of software and a dedicated server you get an application storage space and a bunch of APIs. Pretty interesting approach for hosting from Google, but I must admit it is very conveninent. That way Google takes care about all software and service tuning, configuration, etc. and as a Developet you only have to ... DEVELOP.

Here are some interesting talks about Google's App Engine:

Python, Django and App Engine by Guido van Rossum
Building Scalable Web Apps with App Engine by Brett Slatkin (Google's App Engine main engineers)
App Engine Datastore Under the Covers by Ryan Barrett (lead App Engine datastore)