Need exception and handling of websockets.exceptions.InvalidMessage: did not receive a valid HTTP response
#72
Labels
bug
Something isn't working
If I run example_binance_futures.py and I turn off the network I get:
/home/oliver/PycharmProjects/unicorn-binance-websocket-api/unicorn_binance_websocket_api/unicorn_binance_websocket_api_connection.py:190: RuntimeWarning: coroutine 'WebSocketCommonProtocol.close' was never awaited
self.handler_binance_websocket_api_manager.websocket_list[self.stream_id].close()
and
Exception in thread Thread-1484:
Traceback (most recent call last):
File "/opt/anaconda/oliver/lib/python3.6/site-packages/websockets/http.py", line 139, in read_response
status_line = await read_line(stream)
File "/opt/anaconda/oliver/lib/python3.6/site-packages/websockets/http.py", line 219, in read_line
raise EOFError("line without CRLF")
EOFError: line without CRLF
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/anaconda/oliver/lib/python3.6/site-packages/websockets/client.py", line 101, in read_http_response
status_code, reason, headers = await read_response(self.reader)
File "/opt/anaconda/oliver/lib/python3.6/site-packages/websockets/http.py", line 141, in read_response
raise EOFError("connection closed while reading HTTP status line") from exc
EOFError: connection closed while reading HTTP status line
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/anaconda/oliver/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/opt/anaconda/oliver/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/home/oliver/PycharmProjects/unicorn-binance-websocket-api/unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py", line 295, in _create_stream_thread
loop.run_until_complete(binance_websocket_api_socket.start_socket())
File "/opt/anaconda/oliver/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
return future.result()
File "/home/oliver/PycharmProjects/unicorn-binance-websocket-api/unicorn_binance_websocket_api/unicorn_binance_websocket_api_socket.py", line 56, in start_socket
self.channels, self.markets) as websocket:
File "/home/oliver/PycharmProjects/unicorn-binance-websocket-api/unicorn_binance_websocket_api/unicorn_binance_websocket_api_connection.py", line 97, in aenter
self.handler_binance_websocket_api_manager.websocket_list[self.stream_id] = await self._conn.aenter()
File "/opt/anaconda/oliver/lib/python3.6/site-packages/websockets/client.py", line 517, in aenter
return await self
File "/opt/anaconda/oliver/lib/python3.6/site-packages/websockets/client.py", line 547, in await_impl
extra_headers=protocol.extra_headers,
File "/opt/anaconda/oliver/lib/python3.6/site-packages/websockets/client.py", line 290, in handshake
status_code, response_headers = await self.read_http_response()
File "/opt/anaconda/oliver/lib/python3.6/site-packages/websockets/client.py", line 103, in read_http_response
raise InvalidMessage("did not receive a valid HTTP response") from exc
websockets.exceptions.InvalidMessage: did not receive a valid HTTP response
The text was updated successfully, but these errors were encountered: