wechaty / python-wechaty

Python Wechaty is a Conversational RPA SDK for Chatbot Makers written in Python
https://wechaty.readthedocs.io/zh_CN/latest/
Apache License 2.0
1.56k stars 229 forks source link

EventErrorPayload has not attr code #312

Open linpan opened 2 years ago

linpan commented 2 years ago

payload = EventErrorPayload(**payload_data) | TypeError: __init__() got an unexpected keyword argument 'code'

@dataclass class EventErrorPayload(EventPayloadBase): data: str sees: /wechaty_puppet/schemas/event.py

wj-Mcat commented 2 years ago

Can you give more info about the error?

So I can help you fix this problem.

linpan commented 2 years ago

tokenType: puppetpaimon****

receive event <EventErrorPayload(code=36, ...) receive error info <{'code': 36, 'msg': 'The text (贾玲) is banned'}> EventErrorPayload has no attr "code" or msg.

code status 36 sometime 31. you should debug code status from where.

image
linpan commented 2 years ago

now, I directly edit event.py, add some fields(code, msg, data.....) avoid exception /Users/hiro/Library/Caches/pypoetry/virtualenvs/dichat-Yf_2revS-py3.8/lib/python3.8/site-packages/wechaty_puppet/schemas/event.py

wj-Mcat commented 2 years ago

This problem has been fixed by the new commit for wechaty-puppet. So you can upgrade the wechaty-puppet package to avoid this issue.