I'm trying to set up oauth in Django using Tweepy. I am getting the following error.
AttributeError at /auth/
'dict' object has no attribute 'key'
This occurs in the following code when I try to store the request token for later access when the user is forwarded to the callback url (http://localhost:8000/callback).
def auth(request):
# start the OAuth process, set up a handler with our details
oauth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET, CALLBACK)
# direct the user to the authentication url
# if user is logged-in and authorized then transparently goto the callback URL
try:
auth_url = oauth.get_authorization_url()
except tweepy.TweepError:
return HttpResponse('error', status=500)
# store the request token
request.session['unauthed_token_tw'] = (oauth.request_token.key, oauth.request_token.secret)
return HttpResponseRedirect(auth_url)
I am new to Python and Django, does this error mean that the oauth.request_token is null? Could it be a problem with my callback url? Do I need to forward port 8000? Any help or pointers would be much appreciated!