I had to hack the file a little bit to get the oauth_callback parameter to
work.
I attached the diff to oauthtwitter.py and here's what I had to do in my
own view…
Getting the request token and then authorization url:
callback = '__callback_url_here__'
request_token = twitter.getRequestToken(callback=callback)
request.session[REQUEST_TOKEN_KEY] = request_token.to_string()
authorization_url = twitter.getAuthorizationURL(request_token)
In the callback, getting the authorized request token, adding
oauth_verifier, and then token:
request_token_str = request.session[REQUEST_TOKEN_KEY] // logic if not
exists
request_token = oatwtr.oauth.OAuthToken.from_string(request_token_str)
if 'oauth_verifier' in request.GET:
request_token.set_verifier(request.GET['oauth_verifier'])
twitter = oatwtr.OAuthApi(CONSUMER_KEY, CONSUMER_SECRET, request_token)
try:
access_token = twitter.getAccessToken()
except HTTPError, e:
// error logic here
(Btw, the diff also auto-removes some whitespace, sorry my emacs does that)
Regards,
Peter (http://mrcoles.com)
Original issue reported on code.google.com by
peter.m....@gmail.comon 25 Feb 2010 at 9:09Attachments: