- access_token = dict(cgi.parse_qsl(content))
-
- conn.access = True
- conn.token = access_token['oauth_token']
- conn.token_secret = access_token['oauth_token_secret']
- conn.save()
+ access_token = dict(urlparse.parse_qsl(content))
+
+ if 'oauth_token' in access_token:
+ conn.access = True
+ conn.token = access_token['oauth_token']
+ conn.token_secret = access_token['oauth_token_secret']
+ conn.save()
+ else:
+ return HttpResponse(request.GET.get('error'))