没有项目描述

aioauth-client的Python项目详细描述


aiohttp oauth客户端–oauth对aiohttp/asyncio的支持。

Build Statushttp://img.shields.io/pypi/v/aioauth-client.svg?style=flat-squarehttp://img.shields.io/pypi/dm/aioauth-client.svg?style=flat-square

Requirements

  • python>;=3.5

Installation

aiohttp oauth client应该使用pip安装:

pip install aioauth-client

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()

Example

使用命令运行示例:

make run

在浏览器中打开http://localhost:5000

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

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java我的int值在SharedReferences中不被记住   java如何编辑Spring可分页对象?   java如何在gradle中单独调用任务   jvm以编程方式设置最大java堆大小   java如果满足多个条件,如何使用If语句计算数字?   如何在java中从json文件中获取特定值   如何在Sphinx4中为Java语音识别添加自定义语法?   java int[]copy=data;//当数据是数组时会发生什么?   java豪猪管理器。停下来。destroy()不起作用   安卓在API级别28中找不到画布变量   基于SOLID的java冗余   用于talend作业的java Liferay和portlet   从java到安卓的视频流   java获取在控件的类定义中添加自定义控件的场景大小   awt Java IndexOutOfBoundsException   java如何使用Spring JmsTemplate更改MQ头   java遍历数组并打印每个对象   java Google Map api v2标记在我旋转手机和地图“刷新”之前不会移动