Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Twitter OAuth handler (gae/py, webapp2, tweepy)
import webapp2, tweepy
consumer_token = 'CONSUMER KEY'
consumer_secret = 'CONSUMER SECRET'
auth = tweepy.OAuthHandler(consumer_token, consumer_secret)
class Twitter(webapp2.RequestHandler):
def get(self):
oauth_token = self.request.get("oauth_token")
oauth_verifier = self.request.get("oauth_verifier")
if oauth_token:
auth.get_access_token(oauth_verifier)
try:
api = tweepy.API(auth)
me = api.me()
self.response.write('Hi %s!' % me.name)
except:
auth_url = auth.get_authorization_url()
self.response.write("<a href='%s'>Twitter login</a>" % auth_url)
app = webapp2.WSGIapplication([('/', Twitter)])
def main():
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.