Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

gera2ld/qqlib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

[DEPRECATED] QQ login library based on webqq

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages