From my app r开发者_如何学Pythonunning on GAE, I want to be able to post tweets periodically.
I've a code with which I am able to post tweets from localhost.
import urllib
import urllib2
import simplejson as json
import oauth2 as oauth
consumer_key = ""
consumer_key_secret = ""
oauth_token = ""
oauth_token_secret = ""
consumer = oauth.Consumer(key=consumer_key, secret=consumer_key_secret)
access_token = oauth.Token(key=oauth_token, secret=oauth_token_secret)
client = oauth.Client(consumer, access_token)
url = "http://api.twitter.com/1/statuses/update.json"
data = {'status': 'post this'}
response, data = client.request(url,'POST',urllib.urlencode(data))
Since oauth2 library is not available on GAE, I want to know the easiest means to be able to run the code on GAE.
oauth2
is a pure-python module; it should run fine on App Engine - just bundle it with your app.
You can check for this exmpale. Need to upload oauth2 folder along with your source.
精彩评论