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

客户端报错: Wechaty - ERROR - The network is not good, the bot will try to restart after 60 seconds. #272

Closed xinxinyihao closed 2 years ago

xinxinyihao commented 2 years ago

requirements

Describe your problem

按照这个教程做的:https://wechaty.js.org/2021/04/17/python-wechaty-use-web/

按照上面那个教程,在远程服务器上面使用Docker启动web协议服务,docker应该是正常启动了,后面打印了QRcode的网址之类的。 image

docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d781deb160f1 wechaty/wechaty:latest "/wechaty/bin/entryp…" 6 minutes ago Up 6 minutes 0.0.0.0:8085->8085/tcp, :::8085->8085/tcp wechaty_puppet_service_token_gateway

然后在我本地的电脑上面,按照教程代码,创建了一个bot.py,运行bot.py,连接不到远程docker。 python打印如下: 2021-10-18 20:37:01,401 - HostiePuppet - INFO - init puppet 2021-10-18 20:37:01,604 - HostiePuppet - INFO - starting the puppet ... 2021-10-18 20:37:02,417 - Wechaty - ERROR - The network is not good, the bot will try to restart after 60 seconds. 2021-10-18 20:38:02,417 - Wechaty - INFO - restarting the bot ... 2021-10-18 20:38:02,417 - Wechaty - INFO - wechaty is stoping ... 2021-10-18 20:38:02,417 - Wechaty - INFO - stopping - stop puppet

Your experiments

本地电脑可以正常连接服务器,防火墙也放通了端口。我在服务器上面创建bot.py运行也不行,报同样的错误。我在服务器上面curl ip+端口,结果为:curl: (52) Empty reply from server。是docker里面的东西送不出来么?但是服务器上面的其他docker的web服务器都没有问题啊,麻了。

xinyu3ru commented 2 years ago

TLS enabled 试试关闭Server的TLS

server端 'export WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_SERVER="true"'

client端 'export WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_CLIENT="true"'

如果还是不行,参考 http://wechaty.js.org/docs/puppet-services/diy 让docker container使用主机的网络并且关闭TLS。

xinxinyihao commented 2 years ago

TLS enabled 试试关闭Server的TLS

server端 'export WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_SERVER="true"'

client端 'export WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_CLIENT="true"'

如果还是不行,参考 http://wechaty.js.org/docs/puppet-services/diy 让docker container使用主机的网络并且关闭TLS。

谢谢,谢谢,连上了,非常感谢。