QrLogin and QrSession¶
- class qqqr.qr.QR(png, sig, expired=False)¶
Class
QRrepresents a QR code.- property pushed¶
Whether the QR code is pushed to user's client.
- class qqqr.qr.QrSession(first_qr, login_sig, *, create_time=None, refresh_times=0)¶
- refreshed¶
QR code refresh times counter.
- new_qr(qr)¶
Add a new QR code to this session.
- class qqqr.qr.QrLogin(client, uin, h5=True, app=None, proxy=None, info=None, *args, **kwds)¶
- async new(no_push=False)¶
Create a
QrSession. This method will:GET
xloginurl to getpt_login_sigcookie;Try "quick login" (the QR code is pushed to user's client);
Whether the QR code is pushed or not, a
QRobject is created and is hold by the returnedQrSession.
在 1.8.3 版本发生变更: Added
no_pushparam.
- async show(push_qr=False)¶
This method will call
ptqrshowapi and wrap the response QR bytes intoQR.
- async poll(sess)¶
Poll QR status.
- 抛出:
aiohttp.ClientResponseError -- if response status code != 200
- 返回类型:
- 返回:
a poll response object
- async login(*, refresh_times=6, poll_freq=3, no_push=False)¶
Loop until cookie is returned or max
refresh_timesexceeds.This method will emit
qr_fetchedevent if a new qrcode is fetched.If the QR code is not scanned after
refresh_times, it will raiseUserTimeout.If
refreshis set, it will refresh qrcode at once without increasing expire counter.If
cancelis set, it will raiseUserBreakbefore next polling.
- 参数:
- 抛出:
UserTimeout -- if the QR code is not scanned after
refresh_timesexpires.UserBreak -- if
cancelis set.
在 1.8.3 版本发生变更: Added
no_pushparam.