Required oauth_verifier

This commit is contained in:
David Avsajanishvili 2013-04-11 00:09:53 +01:00
parent 3ffebcc57f
commit ab8bb4ac36
2 changed files with 18 additions and 14 deletions

View file

@ -1,6 +1,5 @@
#!/usr/bin/python
import sys, os
from setuptools import setup
from setuptools import find_packages
@ -17,7 +16,11 @@ setup(
include_package_data = True,
# Package dependencies.
install_requires = ['simplejson', 'oauth2', 'httplib2', 'twython', 'django'],
install_requires = ['simplejson',
'oauth2',
'httplib2',
'twython>=2.7.2',
'django'],
provides = ['twython_django_oauth'],
# Metadata for PyPI.

View file

@ -1,8 +1,7 @@
from django.contrib.auth import authenticate, login, logout as django_logout
from django.contrib.auth.models import User
from django.http import HttpResponse, HttpResponseRedirect
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
from django.conf import settings
from django.core.urlresolvers import reverse
@ -12,6 +11,7 @@ from twython import Twython
# about adapting this to your own setup.
from twython_django_oauth.models import TwitterProfile
def logout(request, redirect_url=settings.LOGOUT_REDIRECT_URL):
"""
Nothing hilariously hidden here, logs a user out. Strip this out if your
@ -59,7 +59,8 @@ def thanks(request, redirect_url=settings.LOGIN_REDIRECT_URL):
)
# Retrieve the tokens we want...
authorized_tokens = twitter.get_authorized_tokens()
authorized_tokens = twitter.get_authorized_tokens(
request.session['request_token']['oauth_verifier'])
# If they already exist, grab them, login and redirect to a page displaying stuff.
try: