tweepy verifier runtime error
Question: I am trying to run a simple app using twitter API wraper called tweepy (with
Python), and I can't get past the verifier step.

My code is really simple.

    
    
    from flask import Flask
    from flask import request
    import flask 
    import tweepy
    
    session=dict()
    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
    
    try:
        redirect_url = auth.get_authorization_url()
        session['request_token']=(auth.request_token.key, auth.request_token.secret)
    except tweepy.TweepError:
        print 'Error! Failed to get request token.'
    
    verifier = request.GET.get('oauth_verifier')
    

It really is the code provided by tweepy documentation, but for some reason,
it keeps returning a runtime error.

    
    
    Runtime Error: working outside of request context
    

Anyone ?


Answer: Executing the script show that the error happens on `verifier =
request.GET.get('oauth_verifier')`, and googling for the error message shows
this error is related to Flask.

So I guess Flask just doesn’t like using `request.GET.get` outside a function
called by Flask (which could be what they call a “request context”).
Basically, you should execute the last line only somewhere it makes sense to
display data (a web server can only display data if there is a web browser
waiting for a response…)

