Esempio n. 1
0
def qqweibo_login(request):
    oauth_handler = txweibo.get_oauth_handler()
    qqweibo_auth_url = oauth_handler.get_authorization_url()
    request.session['redirect_uri'] = _get_referer_url(request)
    request.session['request_token'] = (oauth_handler.request_token.key, oauth_handler.request_token.secret)
    
    return HttpResponseRedirect(qqweibo_auth_url)
Esempio n. 2
0
def qqweibo_login(request):
    oauth_handler = txweibo.get_oauth_handler()
    qqweibo_auth_url = oauth_handler.get_authorization_url()
    request.session['redirect_uri'] = _get_referer_url(request)
    request.session['request_token'] = (oauth_handler.request_token.key,
                                        oauth_handler.request_token.secret)

    return HttpResponseRedirect(qqweibo_auth_url)
Esempio n. 3
0
def qqweibo_auth(request):
    if 'oauth_verifier' not in request.GET:
        return HttpResponseRedirect('/')
    
    verifier = request.GET['oauth_verifier']
    request_token = request.session['request_token']
    del request.session['request_token']
    
    oauth_handler = txweibo.get_oauth_handler()
    oauth_handler.set_request_token(request_token[0], request_token[1])
    access_token = oauth_handler.get_access_token(verifier)
    
    blog_user = txweibo.get_blog_user(access_token)
    
    blog_user['auth_type'] = auth_types['qqweibo']
    blog_user['access_token'] = (access_token.key, access_token.secret)
    request.session['blog_user'] = blog_user
    
    next = request.session['redirect_uri']
    del request.session['redirect_uri']
    
    return HttpResponseRedirect(next)
Esempio n. 4
0
def qqweibo_auth(request):
    if 'oauth_verifier' not in request.GET:
        return HttpResponseRedirect('/')

    verifier = request.GET['oauth_verifier']
    request_token = request.session['request_token']
    del request.session['request_token']

    oauth_handler = txweibo.get_oauth_handler()
    oauth_handler.set_request_token(request_token[0], request_token[1])
    access_token = oauth_handler.get_access_token(verifier)

    blog_user = txweibo.get_blog_user(access_token)

    blog_user['auth_type'] = auth_types['qqweibo']
    blog_user['access_token'] = (access_token.key, access_token.secret)
    request.session['blog_user'] = blog_user

    next = request.session['redirect_uri']
    del request.session['redirect_uri']

    return HttpResponseRedirect(next)