当前位置: 首页>>代码示例>>Python>>正文


Python OAuthToken.set_verifier方法代码示例

本文整理汇总了Python中oauth.OAuthToken.set_verifier方法的典型用法代码示例。如果您正苦于以下问题:Python OAuthToken.set_verifier方法的具体用法?Python OAuthToken.set_verifier怎么用?Python OAuthToken.set_verifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oauth.OAuthToken的用法示例。


在下文中一共展示了OAuthToken.set_verifier方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: oauth_callback

# 需要导入模块: from oauth import OAuthToken [as 别名]
# 或者: from oauth.OAuthToken import set_verifier [as 别名]
def oauth_callback(request):
    print 'In oauth_callback'
    oauth_token    = request.GET['oauth_token']
    oauth_secret   = request.GET['oauth_token_secret']
    oauth_verifier = request.GET['oauth_verifier']

    request_token = OAuthToken(oauth_token, oauth_secret)
    request_token.set_verifier(oauth_verifier)
    
    request.session['request_token']  = request_token
    
    # We do this before we redirect so that there's no "limbo" state where the
    # user has a request token but no access token.
    access_token = CLIENT.fetch_access_token(request_token)
    request.session['oauth_token_string'] = access_token.to_string()
    print "Access token is %s" % access_token.to_string()
    
    profile = request.user.get_profile()
    profile.access_token = access_token.to_string()
    profile.save()

    print "Your account has been associated with Khan Academy username %s" % access_token.to_string()

    # We're done authenticating, and the credentials are now stored in the
    # session. We can redirect back home.
    return HttpResponseRedirect('/homeroom')
开发者ID:TheKNetwork,项目名称:Codename-K,代码行数:28,代码来源:views.py

示例2: do_GET

# 需要导入模块: from oauth import OAuthToken [as 别名]
# 或者: from oauth.OAuthToken import set_verifier [as 别名]
 def do_GET(self):
     global REQUEST_TOKEN
     params = cgi.parse_qs(self.path.split('?', 1)[1], keep_blank_values=False)
     REQUEST_TOKEN = OAuthToken(params['oauth_token'][0], params['oauth_token_secret'][0])
     REQUEST_TOKEN.set_verifier(params['oauth_verifier'][0])
     self.send_response(200)
     self.send_header('Content-Type', 'text/plain')
     self.end_headers()
     self.wfile.write('OAuth request token fetched; you can close this window.')
开发者ID:xmarcosx,项目名称:khan-api,代码行数:11,代码来源:test.py

示例3: do_GET

# 需要导入模块: from oauth import OAuthToken [as 别名]
# 或者: from oauth.OAuthToken import set_verifier [as 别名]
            def do_GET(self):
                global REQUEST_TOKEN
                params = cgi.parse_qs(self.path.split("?", 1)[1], keep_blank_values=False)
                REQUEST_TOKEN = OAuthToken(params["oauth_token"][0], params["oauth_token_secret"][0])
                REQUEST_TOKEN.set_verifier(params["oauth_verifier"][0])

                self.send_response(200)
                self.send_header("Content-Type", "text/plain")
                self.end_headers()
                self.wfile.write("OAuth request token fetched; you can close this window.")
开发者ID:biffhero,项目名称:KhanReporter,代码行数:12,代码来源:KhanOAuthConnector.py

示例4: oauth_callback

# 需要导入模块: from oauth import OAuthToken [as 别名]
# 或者: from oauth.OAuthToken import set_verifier [as 别名]
def oauth_callback():
    oauth_token    = request.args.get('oauth_token',  '')
    oauth_secret   = request.args.get('oauth_token_secret', '')
    oauth_verifier = request.args.get('oauth_verifier', '')

    request_token = OAuthToken(oauth_token, oauth_secret)
    request_token.set_verifier(oauth_verifier)
    
    session['request_token']  = request_token
    
    # We do this before we redirect so that there's no "limbo" state where the
    # user has a request token but no access token.
    access_token = CLIENT.fetch_access_token(request_token)
    session['oauth_token_string'] = access_token.to_string()

    # We're done authenticating, and the credentials are now stored in the
    # session. We can redirect back home.
    return redirect(url_for('.index'))
开发者ID:hsingh23,项目名称:khan-api,代码行数:20,代码来源:explorer.py

示例5: oauth_callback

# 需要导入模块: from oauth import OAuthToken [as 别名]
# 或者: from oauth.OAuthToken import set_verifier [as 别名]
def oauth_callback():
    oauth_token = request.args.get("oauth_token", "")
    oauth_secret = request.args.get("oauth_token_secret", "")
    oauth_verifier = request.args.get("oauth_verifier", "")
    request_token = OAuthToken(oauth_token, oauth_secret)
    request_token.set_verifier(oauth_verifier)
    session["request_token"] = request_token.to_string()
    oauth_request = OAuthRequest.from_consumer_and_token(
                        consumer, 
                        token=request_token, 
                        http_url='http://www.khanacademy.org/api/auth/access_token',
                        callback=None, 
                        parameters=None, 
                        verifier=request_token.verifier
                    )
    oauth_request.sign_request(OAuthSignatureMethod_HMAC_SHA1(), consumer, request_token)
    r = requests.get(oauth_request.to_url())
    access_token = OAuthToken.from_string(r.text)
    session['oauth_token'] = access_token.to_string()
    return redirect(url_for("index"))
开发者ID:xmarcosx,项目名称:khan-academy-dashboard,代码行数:22,代码来源:views.py


注:本文中的oauth.OAuthToken.set_verifier方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。