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


Python TestOAuthClient.fetch_access_token方法代码示例

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


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

示例1: get_access_token_from_user

# 需要导入模块: from test_oauth_client import TestOAuthClient [as 别名]
# 或者: from test_oauth_client.TestOAuthClient import fetch_access_token [as 别名]
def get_access_token_from_user():
    client = TestOAuthClient(consts.SERVER_URL, consts.CONSUMER_KEY, consts.CONSUMER_SECRET)
    client.start_fetch_request_token()

    print "After logging in and authorizing, input token key and secret..."

    request_token_key = raw_input("request token: ")
    request_token_secret = raw_input("request token secret: ")

    request_token = OAuthToken(request_token_key, request_token_secret)
    if not request_token:
        raise IOError("Did not get request token.")

    print "Fetching access token..."
    access_token = client.fetch_access_token(request_token)
    if not access_token:
        raise IOError("Did not get access token.")

    return access_token
开发者ID:DannyBenItzhak,项目名称:analytics,代码行数:21,代码来源:get_access_token.py

示例2: authenticate

# 需要导入模块: from test_oauth_client import TestOAuthClient [as 别名]
# 或者: from test_oauth_client.TestOAuthClient import fetch_access_token [as 别名]
def authenticate():
    """
    Adapted from https://github.com/Khan/khan-api/blob/master/examples/test_client/test.py
    First pass at browser based OAuth authentication.
    """
    # TODO: Allow PIN access for non-browser enabled devices.

    server = create_callback_server()

    client = TestOAuthClient(SERVER_URL, CONSUMER_KEY, CONSUMER_SECRET)

    client.start_fetch_request_token(
        'http://127.0.0.1:%d/' % server.server_address[1])

    server.handle_request()

    server.server_close()

    global ACCESS_TOKEN

    ACCESS_TOKEN = client.fetch_access_token(REQUEST_TOKEN)
开发者ID:aronasorman,项目名称:khan-api-python,代码行数:23,代码来源:api_models.py

示例3: authenticate

# 需要导入模块: from test_oauth_client import TestOAuthClient [as 别名]
# 或者: from test_oauth_client.TestOAuthClient import fetch_access_token [as 别名]
    def authenticate(self):
        """
        Adapted from https://github.com/Khan/khan-api/blob/master/examples/test_client/test.py
        First pass at browser based OAuth authentication.
        """
        # TODO: Allow PIN access for non-browser enabled devices.

        if CONSUMER_KEY and CONSUMER_SECRET:

            server = create_callback_server(self)

            client = TestOAuthClient(
                self.SERVER_URL, CONSUMER_KEY, CONSUMER_SECRET)

            client.start_fetch_request_token(
                'http://127.0.0.1:%d/' % server.server_address[1])

            server.handle_request()

            server.server_close()

            self.ACCESS_TOKEN = client.fetch_access_token(self.REQUEST_TOKEN)
        else:
            print "Consumer key and secret not set in secrets.py - authenticated access to API unavailable."
开发者ID:FundacaoLemann,项目名称:khan-api-python,代码行数:26,代码来源:api_models.py

示例4: get_access_token

# 需要导入模块: from test_oauth_client import TestOAuthClient [as 别名]
# 或者: from test_oauth_client.TestOAuthClient import fetch_access_token [as 别名]
def get_access_token():
    global ACCESS_TOKEN

    client = TestOAuthClient(SERVER_URL, CONSUMER_KEY, CONSUMER_SECRET)
    ACCESS_TOKEN = client.fetch_access_token(REQUEST_TOKEN)
开发者ID:MattFaus,项目名称:KhanReporter,代码行数:7,代码来源:test.py

示例5: get_access_token

# 需要导入模块: from test_oauth_client import TestOAuthClient [as 别名]
# 或者: from test_oauth_client.TestOAuthClient import fetch_access_token [as 别名]
    def get_access_token(self):

        client = TestOAuthClient(self.SERVER_URL, self.CONSUMER_KEY, self.CONSUMER_SECRET)
        self.ACCESS_TOKEN = client.fetch_access_token(REQUEST_TOKEN)
开发者ID:biffhero,项目名称:KhanReporter,代码行数:6,代码来源:KhanOAuthConnector.py

示例6: get_access_token

# 需要导入模块: from test_oauth_client import TestOAuthClient [as 别名]
# 或者: from test_oauth_client.TestOAuthClient import fetch_access_token [as 别名]
def get_access_token():
    global ACCESS_TOKEN
    client = TestOAuthClient(SERVER_URL, CONSUMER_KEY, CONSUMER_SECRET)
    ACCESS_TOKEN = client.fetch_access_token(REQUEST_TOKEN)
    store_credentials( ACCESS_TOKEN.to_string() )
开发者ID:xmarcosx,项目名称:khan-api,代码行数:7,代码来源:test.py


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