Running Example receive 503 error
sequencer opened this issue · 9 comments
2017-12-23 11:31:02 - bittrex_websocket.websocket_client - INFO - Trying to establish connection to Bittrex through https://socket-stage.bittrex.com/signalr.
Exception in thread Thread-2:
Traceback (most recent call last):
File "C:\Program Files\Python36\Lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Program Files\Python36\Lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "D:\Documents\auto_bittrex\python-bittrex-websocket\bittrex_websocket\websocket_client.py", line 287, in _init_connection
conn.start()
File "D:\Documents\auto_bittrex\venv\lib\site-packages\signalr\_connection.py", line 50, in start
listener = self.__transport.start()
File "D:\Documents\auto_bittrex\venv\lib\site-packages\signalr\transports\_auto_transport.py", line 28, in start
return self.__transport.start()
File "D:\Documents\auto_bittrex\venv\lib\site-packages\signalr\transports\_ws_transport.py", line 38, in start
enable_multithread=True)
File "D:\Documents\auto_bittrex\venv\lib\site-packages\websocket\_core.py", line 487, in create_connection
websock.connect(url, **options)
File "D:\Documents\auto_bittrex\venv\lib\site-packages\websocket\_core.py", line 214, in connect
self.handshake_response = handshake(self.sock, *addrs, **options)
File "D:\Documents\auto_bittrex\venv\lib\site-packages\websocket\_handshake.py", line 69, in handshake
status, resp = _get_resp_headers(sock)
File "D:\Documents\auto_bittrex\venv\lib\site-packages\websocket\_handshake.py", line 129, in _get_resp_headers
raise WebSocketBadStatusException("Handshake status %d", status)
websocket._exceptions.WebSocketBadStatusException: Handshake status 503
2017-12-23 11:31:23 - bittrex_websocket.websocket_client - INFO - Failed to subscribe [Trades][['BTC-ETH', 'BTC-XMR']] from connection b00ffeefc6bc4bce8b93e63b18e107e0 after 20 seconds. The connection is probably down.
maybe the problem of url?
I have set the minimum version of cfscrape>=1.9.1. It should work now.
Please report any problems, if they occur, but make sure that you reinstall the bittrex-websocket and that cfscrape>=1.9.1.
Issue solve in macOS. and windows still has same issue.
maybe the node problem?
still finding the problem.
Running it under WIN gives you the referenced error from the first post?
Ok this is what I get from running it under WIN10:
C:\Users\SLazarov Dev\AppData\Local\Programs\Python\Python36\Scripts>
C:\Users\SLazarov Dev\AppData\Local\Programs\Python\Python36\Scripts>py C:\Projects\orderbook.py
2017-12-27 10:54:55 - bittrex_websocket.websocket_client - INFO - Trying to establish connection to Bittrex through https://socket-stage.bittrex.com/signalr.
Exception in thread Thread-3:
Traceback (most recent call last):
File "C:\Users\SLazarov Dev\AppData\Local\Programs\Python\Python36\lib\site-packages\cfscrape\__init__.py", line 114, in solve_challenge
node = execjs.get("Node")
File "C:\Users\SLazarov Dev\AppData\Local\Programs\Python\Python36\lib\site-packages\execjs\_runtimes.py", line 22, in get
return _find_runtime_by_name(name)
File "C:\Users\SLazarov Dev\AppData\Local\Programs\Python\Python36\lib\site-packages\execjs\_runtimes.py", line 61, in _find_runtime_by_name
"{name} runtime is not available on this system".format(name=runtime.name))
execjs._exceptions.RuntimeUnavailableError: Node.js (V8) runtime is not available on this system
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\SLazarov Dev\AppData\Local\Programs\Python\Python36\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\SLazarov Dev\AppData\Local\Programs\Python\Python36\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\SLazarov Dev\AppData\Local\Programs\Python\Python36\lib\site-packages\bittrex_websocket\websocket_client.py", line 287, in _init_connection
conn.start()
File "C:\Users\SLazarov Dev\AppData\Local\Programs\Python\Python36\lib\site-packages\signalr\_connection.py", line 47, in start
negotiate_data = self.__transport.negotiate()
File "C:\Users\SLazarov Dev\AppData\Local\Programs\Python\Python36\lib\site-packages\signalr\transports\_auto_transport.py", line 16, in negotiate
negotiate_data = Transport.negotiate(self)
File "C:\Users\SLazarov Dev\AppData\Local\Programs\Python\Python36\lib\site-packages\signalr\transports\_transport.py", line 26, in negotiate
negotiate = self._session.get(url)
File "C:\Users\SLazarov Dev\AppData\Local\Programs\Python\Python36\lib\site-packages\requests-2.18.4-py3.6.egg\requests\sessions.py", line 521, in get
return self.request('GET', url, **kwargs)
File "C:\Users\SLazarov Dev\AppData\Local\Programs\Python\Python36\lib\site-packages\cfscrape\__init__.py", line 47, in request
return self.solve_cf_challenge(resp, **kwargs)
File "C:\Users\SLazarov Dev\AppData\Local\Programs\Python\Python36\lib\site-packages\cfscrape\__init__.py", line 77, in solve_cf_challenge
params["jschl_answer"] = str(self.solve_challenge(body) + len(domain))
File "C:\Users\SLazarov Dev\AppData\Local\Programs\Python\Python36\lib\site-packages\cfscrape\__init__.py", line 116, in solve_challenge
raise EnvironmentError("Missing Node.js runtime. Node is required. Please read the cfscrape"
OSError: Missing Node.js runtime. Node is required. Please read the cfscrape README's Dependencies section: https://github.com/Anorov/cloudflare-scrape#dependencies
The error is cfscrape
related. I am looking into it.
cfscrape
requires node.js
so you have to download it from the website:
https://nodejs.org/en/download/
I will update the README.
Hi,
Quick note on this issue, which has been also happening to me. I have a multihomed setup where the outbound traffic is load balanced between WAN interfaces. Performing websocket connection upgrade requests would then sometimes fall on an interface with a different public IP than the one on which the CF challenge was requested; in that case the above error happens.