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


Python config.client_id方法代码示例

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


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

示例1: authenticate

# 需要导入模块: import config [as 别名]
# 或者: from config import client_id [as 别名]
def authenticate():
    # Get client ID and secret from config.py

    client = ImgurClient(client_id, client_secret)

    # Authorization flow, pin example (see docs for other auth types)
    authorization_url = client.get_auth_url('pin')

    print("Go to the following URL: {0}".format(authorization_url))

    # Read in the pin, handle Python 2 or 3 here.
    pin = get_input("Enter pin code: ")

    # ... redirect user to `authorization_url`, obtain pin (or code or token) ...
    credentials = client.authorize(pin, 'pin')
    client.set_user_auth(credentials['access_token'], credentials['refresh_token'])

    print("Authentication successful! Here are the details:")
    print("   Access token:  {0}".format(credentials['access_token']))
    print("   Refresh token: {0}".format(credentials['refresh_token']))

    return client


# If you want to run this as a standalone script, so be it! 
开发者ID:twtrubiks,项目名称:line-bot-imgur-tutorial,代码行数:27,代码来源:auth.py

示例2: get_livestreams

# 需要导入模块: import config [as 别名]
# 或者: from config import client_id [as 别名]
def get_livestreams(self):
        print "Requesting stream info"
        for chunk in chunker(self.config.streams, 100):
            api_link = "https://api.twitch.tv/kraken/streams?channel="
            for stream in chunk:
                api_link += stream + ","
            try:
                data = requests.get(api_link, headers={'Client-ID':client_id}).json()
                if data["_total"] > 0:
                    self.parse_stream_info(data)
                else:
                    pass
            except:
                pass 
开发者ID:Andygmb,项目名称:twitchy_the_bot,代码行数:16,代码来源:twitchy.py

示例3: get_login_client

# 需要导入模块: import config [as 别名]
# 或者: from config import client_id [as 别名]
def get_login_client():
    return LinodeLoginClient(config.client_id, config.client_secret) 
开发者ID:linode,项目名称:linode_api4-python,代码行数:4,代码来源:app.py


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