本文整理汇总了Python中sanction.client.Client.access_token_key方法的典型用法代码示例。如果您正苦于以下问题:Python Client.access_token_key方法的具体用法?Python Client.access_token_key怎么用?Python Client.access_token_key使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sanction.client.Client
的用法示例。
在下文中一共展示了Client.access_token_key方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle_foursquare_login
# 需要导入模块: from sanction.client import Client [as 别名]
# 或者: from sanction.client.Client import access_token_key [as 别名]
def handle_foursquare_login(self, data):
self.send_response(200)
self.send_header("Content-type", "text/html")
self.log_message(self.path)
self.end_headers()
c = Client(
token_endpoint="https://foursquare.com/oauth2/access_token",
resource_endpoint="https://api.foursquare.com/v2",
redirect_uri="http://localhost:8080/login/foursquare",
client_id=config["foursquare.client_id"],
client_secret=config["foursquare.client_secret"],
)
c.access_token_key = "oauth_token"
c.request_token(data=data)
d = c.request("/users/24700343")
self.wfile.write("Access token: %s<br>" % c.access_token)
self.wfile.write("First name: %s<br>" %
d["response"]["user"]["firstName"])
self.wfile.write("Last name: %s<br>" %
d["response"]["user"]["lastName"])
self.wfile.write("Email: %s<br>" %
d["response"]["user"]["contact"]["email"])
示例2: handle_foursquare_login
# 需要导入模块: from sanction.client import Client [as 别名]
# 或者: from sanction.client.Client import access_token_key [as 别名]
def handle_foursquare_login(self, data):
c = Client(
token_endpoint='https://foursquare.com/oauth2/access_token',
resource_endpoint='https://api.foursquare.com/v2',
redirect_uri='http://localhost/login/foursquare',
client_id=config['foursquare.client_id'],
client_secret=config['foursquare.client_secret'],
)
c.access_token_key = 'oauth_token'
c.request_token(code=data['code'])
self.dump_client(c)
d = c.request('/users/24700343')
self.dump_response(d)