def console_qr_code(self, uuid, status, qrcode):
status = int(status)
if status == 201:
QR = 'Tap "Confirm" to continue.'
return self.logger.critical(QR)
elif status == 200:
QR = "Successfully authorized."
return self.logger.critical(QR)
elif uuid != self.qr_uuid:
# 0: First QR code
# 408: Updated QR code
QR = "WeChat: Scan QR code with WeChat to continue. (%s, %s)\n" % (uuid, status)
if status == 408:
QR += "Previous code expired. Please scan the new one.\n"
QR += "\n"
qr_url = "https://login.weixin.qq.com/l/" + uuid
qr_obj = QRCode(qr_url)
if self._flag("imgcat_qr", False):
qr_file = io.BytesIO()
qr_obj.png(qr_file, scale=10)
QR += self.imgcat(qr_file, "%s_QR_%s.png" % (self.channel_id, uuid))
else:
QR += qr_obj.terminal()
QR += "\nIf you cannot read the QR code above, " \
"please visit the following URL:\n" \
"https://login.weixin.qq.com/qrcode/" + uuid
return self.logger.critical(QR)
self.qr_uuid = uuid
评论列表
文章目录