Cannot connect bot to Bale messenger API: network connection disconnected
Question:
I was trying my first bot in bale messenger but I couldn’t and faced this error. Is there any one here to help me?
2018-05-05 11:13:47,938 network.py:112 WARNING:"network connection disconnected."
2018-05-05 11:13:47,939 network.py:36 ERROR:"connect error: 500, message='Invalid response status'"
Traceback (most recent call last):
File "/home/ehsan/PycharmProjects/example_bots/venv/lib/python3.5/site-packages/balebot/connection/network.py", line 31, in connect self._ws = await self._session.ws_connect(self.construct_url())
File "/home/ehsan/PycharmProjects/example_bots/venv/lib/python3.5/site-packages/aiohttp/helpers.py", line 109, in __await__ ret = yield from self._coro
File "/home/ehsan/PycharmProjects/example_bots/venv/lib/python3.5/site-packages/aiohttp/client.py", line 465, in _ws_connect
headers=resp.headers) aiohttp.client_exceptions.WSServerHandshakeError: 500, message='Invalid response status'
Answers:
it seems you use a websocket to connect your bot to server. and its a handshake error now. make sure the Token you have given from botfather was correct. If there is no problem with that it may be with your server address.
You are probably giving the wrong token. Re-invoke the bot token using BotFather and make sure your connection is stable.
And by the way,
Since the Bale team does not provide a proper documentation of how the bots should be developed, you may have used balebot; but it is deprecated and I recommend this library instead.
In this way, you can initialize your bot using the snippet below:
"""Bot initialization"""
client = Bot(token="TOKEN")
… using which you can start your bot.
I was trying my first bot in bale messenger but I couldn’t and faced this error. Is there any one here to help me?
2018-05-05 11:13:47,938 network.py:112 WARNING:"network connection disconnected."
2018-05-05 11:13:47,939 network.py:36 ERROR:"connect error: 500, message='Invalid response status'"
Traceback (most recent call last):
File "/home/ehsan/PycharmProjects/example_bots/venv/lib/python3.5/site-packages/balebot/connection/network.py", line 31, in connect self._ws = await self._session.ws_connect(self.construct_url())
File "/home/ehsan/PycharmProjects/example_bots/venv/lib/python3.5/site-packages/aiohttp/helpers.py", line 109, in __await__ ret = yield from self._coro
File "/home/ehsan/PycharmProjects/example_bots/venv/lib/python3.5/site-packages/aiohttp/client.py", line 465, in _ws_connect
headers=resp.headers) aiohttp.client_exceptions.WSServerHandshakeError: 500, message='Invalid response status'
it seems you use a websocket to connect your bot to server. and its a handshake error now. make sure the Token you have given from botfather was correct. If there is no problem with that it may be with your server address.
You are probably giving the wrong token. Re-invoke the bot token using BotFather and make sure your connection is stable.
And by the way,
Since the Bale team does not provide a proper documentation of how the bots should be developed, you may have used balebot; but it is deprecated and I recommend this library instead.
In this way, you can initialize your bot using the snippet below:
"""Bot initialization"""
client = Bot(token="TOKEN")
… using which you can start your bot.