Giter VIP home page Giter VIP logo

qqlib's Introduction

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

qqlib's People

Contributors

gera2ld avatar hondajojo avatar qwivan avatar

Watchers

James Cloos avatar tom avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.