Markandey Singh
Markandey Singh

Reputation: 489

Twitter library for App Engine Python?

I am looking for an Python library which is compatible with app engine and provides an interface to the Twitter API.

I found the python-twitter project - has anyone has used it on app engine?

Upvotes: 7

Views: 2403

Answers (3)

Dexter Legaspi
Dexter Legaspi

Reputation: 3312

As stated, you can use python-twitter (in its current incarnation). To use it, simply add the twitter.py to your Python-GAE project, then to create an instance of the API:

twitter_api = twitter.Api(consumer_key=consumer_key, consumer_secret=consumer_secret, access_token_key=access_token_key, access_token_secret=access_token_secret, cache=None)

It's important to set cache=None because this disables the internal caching which uses the filesystem by default (which is not allowed in GAE). Ideally, somebody should fix this to use memcached...but I'm too laaazzyy... ;-)

Update: OK...this is freaking annoying...you also need to extract the following libraries from the google_appengine lib...meaning you will have to explicitly add the source bundles to your project instead of just referencing them:

  • oauth2
  • httplib2

if you don't add them to your project, it will work locally but not in GAE.

Upvotes: 0

ducu
ducu

Reputation: 1219

I just switched from python-twitter to tweepy. It has better coverage, builtin OAuth and the Streaming API.

Take a look at this fork to work with App Engine.

Later edit (thanks jmlane): The main distribution was fixed to work with App Engine so get it from here.

Upvotes: 6

David Underhill
David Underhill

Reputation: 16243

Yes, you can use python-twitter on app engine (support was added when python-twitter issue 64 was resolved).

Upvotes: 2

Related Questions