没有项目描述
aioauth-client的Python项目详细描述
aiohttp oauth客户端–oauth对aiohttp/asyncio的支持。
Requirements
- python>;=3.5
Usage
# OAuth1fromaioauth_clientimportTwitterClienttwitter=TwitterClient(consumer_key='J8MoJG4bQ9gcmGh8H7XhMg',consumer_secret='7WAscbSy65GmiVOvMU5EBYn5z80fhQkcFWSLMJJu4',)request_token,request_token_secret,_=yield fromtwitter.get_request_token()authorize_url=twitter.get_authorize_url(request_token)print("Open",authorize_url,"in a browser")# ...# Reload client to authorize_url and get oauth_verifier# ...print("PIN code:")oauth_verifier=input()oauth_token,oauth_token_secret,_=yield fromtwitter.get_access_token(oauth_verifier)# Save the tokens for later use# ...twitter=TwitterClient(consumer_key='J8MoJG4bQ9gcmGh8H7XhMg',consumer_secret='7WAscbSy65GmiVOvMU5EBYn5z80fhQkcFWSLMJJu4',oauth_token=oauth_token,oauth_token_secret=oauth_token_secret,)# Or you can use this if you have initilized client already# twitter.access_token = oauth_token# twitter.access_token_secret = oauth_token_secrettimeline=yield fromtwitter.request('GET','statuses/home_timeline.json')content=yield fromtimeline.read()print(content)
# OAuth2fromaioauth_clientimportGithubClientgithub=GithubClient(client_id='b6281b6fe88fa4c313e6',client_secret='21ff23d9f1cad775daee6a38d230e1ee05b04f7c',)authorize_url=github.get_authorize_url(scope="user:email")# ...# Reload client to authorize_url and get code# ...otoken,_=yield fromgithub.get_access_token(code)# Save the token for later use# ...github=GithubClient(client_id='b6281b6fe88fa4c313e6',client_secret='21ff23d9f1cad775daee6a38d230e1ee05b04f7c',access_token=otoken,)# Or you can use this if you have initilized client already# github.access_token = otokenresponse=yield fromgithub.request('GET','user')user_info=yield fromresponse.json()
Bug tracker
如果您有任何建议、错误报告或 烦恼请向问题追踪者报告 在https://github.com/klen/aioauth-client/issues
Contributing
aiohttp oauth客户端的开发发生在:https://github.com/klen/aioauth-client
License
根据MIT license授权。
如果你想对这个角色表示感谢,欢迎你 明信片寄往:
Kirill Klenov pos. Severny d. 8 kv. 3 MO, Istra, 143500 Russia