1 Star 0 Fork 4

yzl11 / pysns

forked from zakzou / pysns 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

pysns

python第三方认证登录包

特性

  • 方便扩展(只需重写一个方法)
  • 支持常见网站(腾讯微博,新浪微博,人人,豆瓣)
  • 支持mac认证

安装

git clone http://git.oschina.net/zakzou/pysns.git
cd pysns
sudo python setup.py install

快速开始

1.1 获取oauth2客户端

import pysns


Douban = pysns.get_client_class('douban')
client = Douban('client_id', 'client_secret', 'you redirect uri')

或者你也可以

import pysns


client = pysns.get_client('douban', 'client_id', 'client_secret', 'redirect_uri')

1.2 获取认证地址

auth_url = client.get_auth_url()
// auth_url = client.get_auth_url(state=state, scope=scope)

1.3 根据code获取acess token

result = client.get_access_token(code)
client.get_user_info(result)

1.4 查看用户信息

client.uid
client.name
client.access_token
client.expires_in
client.refresh_token
client.avatar
client.avatar_large

示例

查看example/app.py

许可证

MIT: http://rem.mit-license.org

pysns ================ python第三方认证登录包 特性 =============== * 方便扩展(只需重写一个方法) * 支持常见网站(腾讯微博,新浪微博,人人,豆瓣) * 支持mac认证 安装 ================ ```shell git clone http://git.oschina.net/zakzou/pysns.git cd pysns sudo python setup.py install ``` 快速开始 ================ ### 1.1 获取oauth2客户端 ```python import pysns Douban = pysns.get_client_class('douban') client = Douban('client_id', 'client_secret', 'you redirect uri') ``` 或者你也可以 ```python import pysns client = pysns.get_client('douban', 'client_id', 'client_secret', 'redirect_uri') ``` ### 1.2 获取认证地址 ```python auth_url = client.get_auth_url() // auth_url = client.get_auth_url(state=state, scope=scope) ``` ### 1.3 根据code获取acess token ```python result = client.get_access_token(code) client.get_user_info(result) ``` ### 1.4 查看用户信息 ```pyton client.uid client.name client.access_token client.expires_in client.refresh_token client.avatar client.avatar_large ``` 示例 ============ 查看`example/app.py` 许可证 =============== MIT: http://rem.mit-license.org

简介

python第三方认证登录库 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yzl11/pysns.git
git@gitee.com:yzl11/pysns.git
yzl11
pysns
pysns
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891