Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need exception and handling of websockets.exceptions.InvalidMessage: did not receive a valid HTTP response #72

Closed
oliver-zehentleitner opened this issue May 12, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@oliver-zehentleitner
Copy link
Member

oliver-zehentleitner commented May 12, 2020

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

@oliver-zehentleitner oliver-zehentleitner added the bug Something isn't working label May 12, 2020
@oliver-zehentleitner oliver-zehentleitner self-assigned this May 12, 2020
Seven-112 pushed a commit to Seven-112/unicorn-binance-websocket-api that referenced this issue May 16, 2023
…d added methods to determine system usage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant