This is a duplicate of the other post. I am using the request_oauthlib module to retrieve the access token now but I am running into an error where the client verifier is missing. What should I use the PIN for after the I authorize the app?
from requests_oauthlib import OAuth1Session
from requests_oauthlib import OAuth1
import requests
client_key = <<consumer_key>>
client_secret = <<consumer_secret>>
request_token_url = 'https://api.twitter.com/oauth/request_token'
oauth = OAuth1Session(client_key, client_secret=client_secret)
fetch_response = oauth.fetch_request_token(request_token_url)
#this returns the oauth token secret and oauth token and oauth callback confirmed as true
resource_owner_key = fetch_response.get('oauth_token_secret')
resource_owner_secret = fetch_response.get('oauth_owner_secret')
base_authorization_url = 'https://api.twitter.com/oauth/authorize'
authorization_url = oauth.authorization_url(base_authorization_url)
print 'Please go here and authorize,', authorization_url
# I authorize the app and get a pin
redirect_response = authorization_url
oauth_response = oauth.parse_authorization_response(redirect_response)
verifier = oauth_response.get('oauth_verifier')
#this returns the oauth token (same token as previous step) but it doesn't return a client verifier
access_token_url = 'https://api.twitter.com/oauth/access_token'
oauth = OAuth1Session(client_key,
client_secret=client_secret,
resource_owner_key=resource_owner_key,
resource_owner_secret=resource_owner_secret,
verifier=verifier)
oauth_tokens = oauth.fetch_access_token(access_token_url)
#gives a error no client verifier has been set.