diff --git a/channel/wechat/wechat_channel.py b/channel/wechat/wechat_channel.py index ce3f0861e..4f3c2c96f 100644 --- a/channel/wechat/wechat_channel.py +++ b/channel/wechat/wechat_channel.py @@ -10,6 +10,7 @@ import threading import time import requests +import qrcode from bridge.context import * from bridge.reply import * @@ -87,6 +88,14 @@ def qrCallback(uuid, status, qrcode): url = f"https://login.weixin.qq.com/l/{uuid}" + img = qrcode.make(data=url) + + if not os.path.exists('tmp'): + os.makedirs('tmp') + + with open('tmp/login.png', 'wb') as f: + img.save(f) + qr_api1 = "https://api.isoyu.com/qr/?m=1&e=L&p=20&url={}".format(url) qr_api2 = "https://api.qrserver.com/v1/create-qr-code/?size=400×400&data={}".format(url) qr_api3 = "https://api.pwmqr.com/qrcode/create/?url={}".format(url)