qql

qqlib

[DEPRECATED] QQ login library based on webqq

Showing:

Popularity

Downloads/wk

0

GitHub Stars

166

Maintenance

Last Commit

4yrs ago

Contributors

3

Package

Dependencies

2

License

MIT

Categories

Readme

qqlib

PyPI

Python版QQ登录库,兼容Python2.x和Python3.x。

安装

$ pip install qqlib
# or
$ pip install git+https://github.com/gera2ld/qqlib.git

快速开始

$ python -m qqlib

高级用法

def login(qq):
    # 不考虑验证码的情况,直接登录
    qq.login()

import qqlib
qq = qqlib.QQ(12345678, 'password')
login(qq)
print('Hi, %s' % qq.nick)

登录时有可能出现需要验证码的情况,可以捕获到qqlib.NeedVerifyCode错误。这时qq.need_verifyTrue,需要获取验证码图片(qq.verifier.fetch_image())进行处理,验证(qq.verifier.verify(code))之后再继续登录。下面是支持输入验证码的login方法:

def login(qq):
    # 自动重试登录
    while True:
        try:
            if qq.need_verify:
                open('verify.jpg', 'wb').write(qq.verifier.fetch_image())
                print('验证码已保存到verify.jpg')
                # 输入验证码
                vcode = input('请输入验证码:')
                qq.verifier.verify(vcode)
            qq.login()
            break
        except qqlib.NeedVerifyCode as exc:
            if exc.message:
                print('Error:', exc.message)

QZone:

from qqlib import qzone
qq = qzone.QZone(12345678, 'password')
# 登录流程同上
login(qq)
qq.feed('发一条说说')

测试

# Python 2
$ python -m unittest discover

# Python 3
$ python3 -m unittest

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100