wechaty / python-wechaty-puppet-itchat

Python Wechaty Puppet Powered by Itchat
Apache License 2.0
39 stars 11 forks source link

KeyError: 'wxsid' #36

Closed xyangwu closed 1 year ago

xyangwu commented 2 years ago

requirements

Error, KeyError: 'wxsid'

Error, "KeyError: 'wxsid'", occured after scanning qrcode and confirming on mobile phone.

Reproduce problem

import asyncio
from wechaty import Wechaty
from wechaty_puppet_itchat import PuppetItChat

option = {
    'WECHATY_PUPPET': "wechaty-puppet-service",
    'WECHATY_PUPPET_SERVICE_ENDPOINT': "127.0.0.1:5000"
}
bot = Wechaty(PuppetItChat(option))
bot.on('message', lambda x: print(x))
asyncio.run(bot.start())

Error info

Traceback (most recent call last):
  File "wx_bot_itchat.py", line 13, in <module>
    asyncio.run(bot.start())
  File "C:\XYA\anaconda3\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\XYA\anaconda3\lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "C:\XYA\anaconda3\lib\site-packages\wechaty\wechaty.py", line 419, in start
    await self.puppet.start()
  File "C:\XYA\anaconda3\lib\site-packages\wechaty_puppet_itchat\puppet.py", line 984, in start
    await self._listen_for_event()
  File "C:\XYA\anaconda3\lib\site-packages\wechaty_puppet_itchat\puppet.py", line 1059, in _listen_for_event
    await self.itchat.auto_login(
  File "C:\XYA\anaconda3\lib\site-packages\wechaty_puppet_itchat\itchat\components\register.py", line 32, in auto_login
    await self.login(enableCmdQR=enableCmdQR, picDir=picDir, qrCallback=qrCallback, EventScanPayload=EventScanPayload, ScanStatus=ScanStatus, event_stream=event_stream,
  File "C:\XYA\anaconda3\lib\site-packages\wechaty_puppet_itchat\itchat\components\login.py", line 65, in login
    status = await self.check_login()
  File "C:\XYA\anaconda3\lib\site-packages\wechaty_puppet_itchat\itchat\components\login.py", line 181, in check_login
    if await process_login_info(self, r.text):
  File "C:\XYA\anaconda3\lib\site-packages\wechaty_puppet_itchat\itchat\components\login.py", line 223, in process_login_info
    core.loginInfo['wxsid'] = core.loginInfo['BaseRequest']['Sid'] = cookies["wxsid"]
KeyError: 'wxsid'

Your experiments

I didn't use docker (It might be the reason why error occured?)

lyleshaw commented 2 years ago

Because WeChat has banned UOS WeChat, WeChat accounts registered before 2017 cannot use this puppet to login. Waiting for a solution to this problem.

xyangwu commented 2 years ago

Thank you for your answer :D

fangjiyuan commented 1 year ago

UOS has come back.