Closed sir1st closed 2 years ago
Pay attention to
You need to use url encode before put qrcode into url.
For wxwork puppet, the i got the following messages: the original qrcode data is this: https://wx.work.weixin.qq.com/cgi-bin/crtx_auth?key=2675731755F395E7CF2B970981C89FE2&wx=1 and the generated link is this: 2021-12-14 10:39:57,721 - Wechaty - INFO - or you can scan qrcode from: https://wechaty.js.org/qrcode/https://wx.work.weixin.qq.com/cgi-bin/crtx_auth?key=2675731755F395E7CF2B970981C89FE2&wx=1 After i open that link and scan the qr code , i got the result in the Error Info link.
but if i use the puppet_paimon protocol, the original code works, and i can scan this qr code to login. https://wechaty.js.org/qrcode/http://weixin.qq.com/x/Q98hhYsKZH2w6zxDg6gf
Definitely, i run the same code except the different puppet token.
Also, the wechaty-js works just fine for the same wxwork puppet... I maybe find the reason.. js-wechaty use this link... StarterBot onScan: %s(%s) - %s Waiting 2 https://wechaty.js.org/qrcode/https%3A%2F%2Fwx.work.weixin.qq.com%2Fcgi-bin%2Fcrtx_auth%3Fkey%3D1DBD6C1542BDFD5B8FFE980C27AE9E9C%26wx%3D1
Thx, Finally it works. After i add the following code in python. Hope to make an improvement in the wechaty-python source code. Appreciate!
from urllib.parse import quote async def on_scan( qrcode: str, status: ScanStatus, _data, ): """ Scan Handler for the Bot """ print('Status: ' + str(status)) print('View QR Code Online: https://wechaty.js.org/qrcode/'+quote(qrcode))
print('View QR Code Online: https://wechaty.js.org/qrcode/'+quote(qrcode))
Yes, this is the correct solution.
PR to improve the example code is welcome.
requirements
Describe your problem
unable to login by scanning the qr code. but after login with puppet using js wechaty, python-wechaty works ( this skips the scan qr code step)
Reproduce your problem
Error info
I got something like this after scan the qr code (note: i did use the correct scan tools (the android wework-com))