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.55k stars 229 forks source link

[Bug]: Unable to connect wechaty-puppet-service #392

Closed wellcoming closed 1 year ago

wellcoming commented 1 year ago

Environment

- wechaty: 1.20.2
- wechaty-puppet-xp: 1.12.7
- token type: xp
- the version of wechaty docker container: None

Description

Log:
2023-05-02 00:58:49,891 - PuppetService - WARNING - there are endpoint<127.0.0.1:8788> and token<insecure_0218015d-6a3b-xxxx-xxxx-2a511836xxxx>, and the endpoint will be used for service ...
2023-05-02 00:58:49,929 - Wechaty - INFO - init_puppet_event_bridge() <<wechaty_puppet_service.puppet.PuppetService object at 0x0000016E71DC0430>>
2023-05-02 00:58:49,929 - Wechaty - INFO - initPuppetEventBridge() puppet.on(dong) (listenerCount:1) registering...
2023-05-02 00:58:49,929 - Wechaty - INFO - initPuppetEventBridge() puppet.on(error) (listenerCount:1) registering...
2023-05-02 00:58:49,929 - Wechaty - INFO - initPuppetEventBridge() puppet.on(heart-beat) (listenerCount:1) registering...
2023-05-02 00:58:49,929 - Wechaty - INFO - initPuppetEventBridge() puppet.on(ready) (listenerCount:1) registering...
2023-05-02 00:58:49,929 - Wechaty - INFO - receive <reset> event <%s>
2023-05-02 00:58:49,929 - Wechaty - INFO - initPuppetEventBridge() puppet.on(reset) (listenerCount:0) registering...
2023-05-02 00:58:49,938 - Wechaty - INFO - initPuppetEventBridge() puppet.on(friendship) (listenerCount:1) registering...
2023-05-02 00:58:49,938 - Wechaty - INFO - initPuppetEventBridge() puppet.on(login) (listenerCount:1) registering...
2023-05-02 00:58:49,938 - Wechaty - INFO - initPuppetEventBridge() puppet.on(logout) (listenerCount:1) registering...
2023-05-02 00:58:49,938 - Wechaty - INFO - initPuppetEventBridge() puppet.on(message) (listenerCount:1) registering...
2023-05-02 00:58:49,938 - Wechaty - INFO - initPuppetEventBridge() puppet.on(room-invite) (listenerCount:1) registering...
2023-05-02 00:58:49,938 - Wechaty - INFO - initPuppetEventBridge() puppet.on(room-join) (listenerCount:1) registering...
2023-05-02 00:58:49,938 - Wechaty - INFO - initPuppetEventBridge() puppet.on(room-leave) (listenerCount:1) registering...
2023-05-02 00:58:49,938 - Wechaty - INFO - initPuppetEventBridge() puppet.on(room-topic) (listenerCount:1) registering...
2023-05-02 00:58:49,938 - Wechaty - INFO - initPuppetEventBridge() puppet.on(scan) (listenerCount:1) registering...
2023-05-02 00:58:49,938 - Wechaty - INFO - starting puppet ...
2023-05-02 00:58:49,938 - PuppetService - INFO - init puppet ...
2023-05-02 00:58:49,954 - PuppetService - INFO - starting the puppet ...
2023-05-02 00:58:49,954 - Wechaty - ERROR - The network is not good, the bot will try to restart after 60 seconds.
But here are some suggestions for you:
* 查看token是否可用?(过期或协议不可用)
* docker 服务是否正常启动?
* python-wechaty bot 是否正常启动?
* python-wechaty bot 是否能ping通docker服务?
* 由于版本细节问题,目前python-wechaty 支持最好的wechaty镜像为:[wechaty/wechaty:0.65](https://hub.docker.com/layers/wechaty/wechaty/0.65/images/sha256-d39b9fb5dece3a8ffa88b80a8ccfd916be14b9d0de72115732c3ee714b0d6a96?context=explore)

I suggest that you should follow the template code from: https://wechaty.readthedocs.io/zh_CN/latest/ to avoid the unnecessary bugs.

environment variables:
endpoint=127.0.0.1:8788;
WECHATY_PUPPET=wechaty-puppet-service;
WECHATY_PUPPET_SERVICE_TOKEN=insecure_0218015d-6a3b-xxxx-xxxx-2a511836xxxx

description:
I have deploy `Wechaty Token Gateway for Puppet XP` on my local server. When I use JS to connect this puppet, it will work fine. But if I use python, it won't work.

Minimum reproducible code

import asyncio
import os
from wechaty import Wechaty

if __name__ == "__main__":
    bot = Wechaty()
    asyncio.run(bot.start())
immortal-autumn commented 2 months ago

How this problem is being solved?