예제 #1
0
파일: views.py 프로젝트: ppp0/openbroadcast
def login_done(request):
    app = TwitterApp.objects.get_current()
    client = OAuthTwitter(
        request, app.consumer_key,
        app.consumer_secret,
        app.request_token_url)
    try:
        user_info = client.get_user_info()
    except OAuthError, e:
        return render_authentication_error(request)
예제 #2
0
def login_done(request):
    app = TwitterApp.objects.get_current()
    client = OAuthTwitter(request, app.consumer_key, app.consumer_secret,
                          app.request_token_url)
    user_info = client.get_user_info()
    try:
        account = TwitterAccount.objects.get(social_id=user_info['id'])
    except TwitterAccount.DoesNotExist:
        account = TwitterAccount(social_id=user_info['id'])
    account.profile_image_url = user_info['profile_image_url']
    account.username = user_info['screen_name']
    if account.pk:
        account.save()
    data = dict(twitter_user_info=user_info, username=account.username)
    return complete_social_login(request, data, account)