當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。