• Stars
    star
    324
  • Rank 129,708 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created over 11 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

OAuth2 for Chinese social sites

socialoauth

Python Package For SNS sites with OAuth2 support

socialoauth 专注于中国大陆开放了OAuth2认证的网站

Feature

  • 易于扩展 参见doc.md

  • 统一的接口

    • 各个站点,都有 uid, name, avatar, 属性

      QQ 取回的 avatar 是40x40尺寸的,其余站点基本都是 48~50的尺寸

    • 各个站点,都有统一的 api_http_getapi_http_post 接口

  • 统一的错误处理

    api_http_getapi_http_post 都可能引发异常,

    应用程序只要 try ... except SocialAPIError as e 就能得到一致的错误信息:

    • e.site_name 哪个站点发生错误
    • e.url 发生错误是请求的url
    • e.api_error_msg 由站点返回的错误信息 or urllib2 的错误信息

Supported sites

  • 人人
  • 腾讯
  • 豆瓣
  • 新浪微博
  • 网易微博
  • 搜狐微博
  • 百度
  • 开心网
  • 淘宝
  • 微信

Contributors

Thanks for this guys

Jiequan

smilekzs

andelf

zxkane

yuanxu

Install

pip install socialoauth

# or

git clone https://github.com/yueyoum/social-oauth.git
cd social-oauth
python setup.py install

Example

快速体验 socialoauth

git clone https://github.com/yueyoum/social-oauth.git
cd social-oauth/example
cp settings.py.example settings.py

# 在这里按照你的情况修改settings.py

python index.py

如何配置 settings.py ? 参见doc.md

现在用浏览器打开对应的地址,就能体验相应的功能。

下面是我用 人人网 帐号登录的过程:

初始情况,首页只有一个 login 链接

step1

点击后,根据settings.py中的设置,显示可用的认证网站

step2

我用人人网帐号进行测试,点击后,转到人人登录认证的界面

step3

认证完毕后,就会显示用户的名字和小头像。

example中有个简单的session机制, 此时再打开首页(不关闭浏览器)就不用再登录,会直接显示名字和头像

step4

Document

参见doc.md

吐槽

  • 新浪微博,腾讯, 开心网的文档是最好的。

  • 人人网文档虽然内容丰富,但层次略混乱

  • 豆瓣文档太简陋

  • 搜狐文档就是个渣!!! 都不想添加搜狐支持了

  • 发现一些文档和实际操作有出入, 主要是文档里说的必要参数,不传也一样工作

    • 腾讯 文档里说取code的时候,state 必须 参数,但发现不传一样
    • 搜狐 和上面一样, wrap_client_state 参数

More Repositories

1

make-proxy

HTTP/HTTPS/Socks4/Socks5 proxy written in Erlang
Erlang
270
star
2

django-siteuser

Register, Login, OAuth2, Upload avatar...
Python
256
star
3

renren-relationship

人人好友关系
Python
186
star
4

seven-cow

Yet another qiniu cloud storage Python SDK. More Pythonic, More simple to use
Python
132
star
5

django-social-login

[DISCARDED]A Django APP for Social accounts login via OAuth2 Service
Python
104
star
6

codebattle-ai

AI Example for Codebattle
Erlang
45
star
7

django-upload-avatar

A django app for upload avatars
Python
40
star
8

paper

Feel free about writing blog. This is a simple blog system, Just bloging, Implemented on bottle
Python
35
star
9

playground

Erlang
32
star
10

duckadmin

A Django reusable app for show and operate custom forms in admin.
Python
30
star
11

abchat

Abstract Simple Chat Server Based on Gevent
Python
24
star
12

timerush

Python Timer Framework
Python
21
star
13

djangowebsocket

Python
20
star
14

i3-dzen2-bridge

Bridged the i3status and dzen2 to make dzen2 display icons
Python
20
star
15

vim-linemovement

simplify the line movement in vim
Vim Script
20
star
16

unity3d-scripts

A Collections of useful Scripts/Examples for Unity3d
C#
18
star
17

codebattle-server

codebattle server
Erlang
17
star
18

daemonize

Python Daemonize
Python
15
star
19

redis-lua-scripts

Lua script using with Redis
Python
14
star
20

vim-alignment

Align What You Want!
Vim Script
13
star
21

eipp

A C++11 Header Only Library for using erlang ei library.
C++
13
star
22

python-gears

A BBS Based On Django.
JavaScript
11
star
23

myblogposts

Posts of my blog
10
star
24

learn-you-some-erlang-zh

learn you some erlang 的简体中文翻译
9
star
25

codebattle-client

unity3d client of codebattle
C#
7
star
26

TRsound

For prononnce words with a terminal translation
C
4
star
27

gstatus

display git log in browser
Python
3
star
28

codebattle-proto

proto files for codebattle
3
star
29

django-admin-lastlocation

Return the last location after editing some item
Python
3
star
30

dianjing

Python
2
star
31

myfirefox

firefox plugins
2
star
32

redis-benchmark

Erlang
2
star
33

notebook

Erlang
2
star
34

arrow

Erlang Datetime Utils
Erlang
2
star
35

termgif

record your terminal to animated gif
C
2
star
36

mytools

自己的一些脚本工具
Python
1
star
37

sudoku

sudoku solved in my own way
C++
1
star
38

aoi

C++
1
star
39

smoke

A set collections of WSGI Middleware
Python
1
star
40

sanguo-server

Python
1
star