示例#1
0
 def console_qr_code(self, uuid, status, qrcode=None):
     status = int(status)
     if self.qr_uuid == (uuid, status):
         return
     self.qr_uuid = (uuid, status)
     if status == 201:
         qr = self._('Confirm on your phone.')
         return self.logger.log(99, qr)
     elif status == 200:
         qr = self._("Successfully logged in.")
         return self.logger.log(99, qr)
     else:
         # 0: First QR code
         # 408: Updated QR code
         qr = self._("EWS: Please scan the QR code with your camera, screenshots will not work. ({0}, {1})") \
                  .format(uuid, status) + "\n"
         if status == 408:
             qr += self._("QR 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"):
             qr_file = io.BytesIO()
             qr_obj.png(qr_file, scale=10)
             qr_file.seek(0)
             qr += self.imgcat(qr_file, "%s_QR_%s.png" % (self.channel_id, uuid))
         else:
             qr += qr_obj.terminal()
         qr += "\n" + self._("If the QR code was not shown correctly, please visit:\n" \
                             "https://login.weixin.qq.com/qrcode/{0}").format(uuid)
         return self.logger.log(99, qr)
示例#2
0
 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
示例#3
0
def print_QRImage():
    global tip
    #url = 'https://login.weixin.qq.com/qrcode/' + uuid
    qrCode = QRCode('https://login.weixin.qq.com/l/' + uuid)
    printCode = qrCode.terminal(quiet_zone=1)
    # if sys.platform.find('win') >= 0:
    # printCode = printCode.encode("UTF-8").decode("GB2312")
    # # printCode = re.replace(""," ")
    # # printCode = re.replace("","█")
    print(printCode)
    params = {
        't': 'webwx',
        '_': int(time.time()),
    }
    #断点
    sys.exit()
    # r = myRequests.get(url=url, params=params)
    # print(r.content)
    # tip = 1
    print('请使用微信扫描二维码以登录')
示例#4
0
 def print_cli_qrcode(self):
     self.uuid = self.get_login_uuid()
     qr_code = QRCode(WeChatMeta.URL['qr_code'] + self.uuid)
     qr_code.svg('uca-url.svg', scale=6)
     print(qr_code.terminal(quiet_zone=1))