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 http://bit.ly

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

# First you need to create an app here
# http://twitter.com/oauth or http://dev.twitter.com/apps/
# and get the codes below
TWITTER_CONSUMER_KEY = 'YOUR KEY'
TWITTER_CONSUMER_SECRET = 'YOUR SECRET'
# The next codes are found http://dev.twitter.com/apps/
# right menu, after you clicked on the app
TWITTER_ACCESS_TOKEN = 'TWITTER TOKEN'
TWITTER_ACCESS_TOKEN_SECRET = 'TWITTER TOKEN SECRET'
# bit.ly api keys found at: http://bit.ly/a/your_api_key
BIT_LY_USERNAME = 'YOUR USERNAME'
BIT_LY_API_KEY = 'YOUR API KEY'
# Google reader feed URL
# example is mine below
GOOGLE_READER_FEED_URL = 'http://www.google.com/reader/public/atom/user/07723902623423188282/state/com.google/broadcast'

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

No comments:

Post a Comment