本文整理匯總了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!
示例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
示例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)