eh_wechat_slave.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:ehForwarderBot 作者: blueset 项目源码 文件源码
def master_qr_code(self, uuid, status, qrcode):
        status = int(status)
        msg = EFBMsg(self)
        msg.type = MsgType.Text
        msg.source = MsgSource.System
        msg.origin = {
            'name': '%s Auth' % self.channel_name,
            'alias': '%s Auth' % self.channel_name,
            'uid': -1
        }
        if status == 201:
            msg.type = MsgType.Text
            msg.text = 'Tap "Confirm" to continue.'
        elif status == 200:
            msg.type = MsgType.Text
            msg.text = "Successfully authenticated."
        elif uuid != self.qr_uuid:
            msg.type = MsgType.Image
            path = os.path.join("storage", self.channel_id)
            if not os.path.exists(path):
                os.makedirs(path)
            path = os.path.join(path, 'QR-%s.jpg' % int(time.time()))
            self.logger.debug("master_qr_code file path: %s", path)
            qr_url = "https://login.weixin.qq.com/l/" + uuid
            QRCode(qr_url).png(path, scale=10)
            msg.text = 'Scan this QR Code with WeChat to continue.'
            msg.path = path
            msg.file = open(path, 'rb')
            msg.mime = 'image/jpeg'
        if status in (200, 201) or uuid != self.qr_uuid:
            self.queue.put(msg)
            self.qr_uuid = uuid
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号