本文整理汇总了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)