Open davidfindlay opened 6 years ago
Paste your modified code.
`from bittrex_websocket.websocket_client import BittrexSocket from time import sleep
def main(): class MySocket(BittrexSocket):
def on_public(self, msg):
name = msg['M']
if name not in ticker_updates_container:
ticker_updates_container[name] = msg
print('Just received market update for {}.'.format(name))
# Create container
ticker_updates_container = {}
# Create the socket instance
ws = MySocket()
# Enable logging
ws.enable_log()
# Define tickers
tickers = ['BTC-ETH', 'BTC-NEO', 'BTC-ZEC', 'ETH-NEO', 'ETH-ZEC']
# Subscribe to ticker information
for ticker in tickers:
sleep(0.01)
ws.subscribe_to_exchange_deltas([ticker])
# Users can also subscribe without introducing delays during invoking but
# it is the recommended way when you are subscribing to a large list of tickers.
# ws.subscribe_to_exchange_deltas(tickers)
while len(ticker_updates_container) < len(tickers):
sleep(1)
else:
print('We have received updates for all tickers. Closing...')
ws.disconnect()
sleep(10)
if name == "main": main()`
Current code I've got.
Output:
2018-08-06 10:59:04 - bittrex_websocket.websocket_client - INFO - Establishing connection to Bittrex through https://socket.bittrex.com/signalr.
2018-08-06 10:59:04 - bittrex_websocket.websocket_client - INFO - cfscrape detected, will try to bypass Cloudflare if enabled.
2018-08-06 10:59:08 - bittrex_websocket.websocket_client - ERROR -
Unhandled Exception = <class 'ssl.SSLError'>, Message = <[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)>.
Auto-reconnection is disabled for unhandled exceptions.
Report to https://github.com/slazarov/python-bittrex-websocket.
2018-08-06 10:59:14 - bittrex_websocket.websocket_client - ERROR - Connection timeout after 10 seconds. Sending a reconnection signal.
Exception in thread ControlQueueThread:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/bittrex_websocket/websocket_client.py", line 80, in control_queue_handler
self._handle_subscribe(event)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/bittrex_websocket/websocket_client.py", line 180, in _handle_subscribe
self.invokes.append({'invoke': event.invoke, 'ticker': event.payload[0][0]})
AttributeError: 'CloseEvent' object has no attribute 'invoke'
Sorry for the late reply, what version are you using? Where did you pass the SSL params?
I've just updated to 1.0.6.2 today from pip. I'm not currently passing any SSL params, so I've just copied the code from the first example here under quick start: https://github.com/slazarov/python-bittrex-websocket
2018-08-30 07:13:15 - bittrex_websocket.websocket_client - INFO - Establishing connection to Bittrex through https://socket.bittrex.com/signalr. 2018-08-30 07:13:15 - bittrex_websocket.websocket_client - INFO - cfscrape detected, will try to bypass Cloudflare if enabled. 2018-08-30 07:13:16 - bittrex_websocket.websocket_client - ERROR - Unhandled Exception = <class 'ssl.SSLError'>, Message = <[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)>. Auto-reconnection is disabled for unhandled exceptions. Report to https://github.com/slazarov/python-bittrex-websocket.
Can you install the library in a clean venv?
Looks to me that requests is installed without security, i.e request[security].
On Aug 30, 2018 at 12:15 am, <David Findlay (mailto:notifications@github.com)> wrote:
I've just updated to 1.0.6.2 today from pip. I'm not currently passing any SSL params, so I've just copied the code from the first example here under quick start: https://github.com/slazarov/python-bittrex-websocket
2018-08-30 07:13:15 - bittrex_websocket.websocket_client - INFO - Establishing connection to Bittrex through https://socket.bittrex.com/signalr. 2018-08-30 07:13:15 - bittrex_websocket.websocket_client - INFO - cfscrape detected, will try to bypass Cloudflare if enabled. 2018-08-30 07:13:16 - bittrex_websocket.websocket_client - ERROR - Unhandled Exception = <class 'ssl.SSLError'>, Message = <[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)>. Auto-reconnection is disabled for unhandled exceptions. Report to https://github.com/slazarov/python-bittrex-websocket.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub (https://github.com/slazarov/python-bittrex-websocket/issues/73#issuecomment-417108387), or mute the thread (https://github.com/notifications/unsubscribe-auth/AbVUG-Wz4q2d_wWvI5x0wVPvcC5TuzLBks5uVwRrgaJpZM4VSFRJ).
Just looking to try to do that. Looking at trying to install the extra in case it wasn't there:
Requirement already satisfied: requests[security] in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (2.19.1) Requirement already satisfied: urllib3<1.24,>=1.21.1 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests[security]) (1.22) Requirement already satisfied: idna<2.8,>=2.5 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests[security]) (2.5) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests[security]) (3.0.4) Requirement already satisfied: certifi>=2017.4.17 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests[security]) (2017.7.27.1) Requirement already satisfied: cryptography>=1.3.4; extra == "security" in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests[security]) (2.1.4) Requirement already satisfied: pyOpenSSL>=0.14; extra == "security" in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests[security]) (17.5.0) Requirement already satisfied: asn1crypto>=0.21.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from cryptography>=1.3.4; extra == "security"->requests[security]) (0.24.0) Requirement already satisfied: cffi>=1.7; platform_python_implementation != "PyPy" in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from cryptography>=1.3.4; extra == "security"->requests[security]) (1.11.2) Requirement already satisfied: six>=1.4.1 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from cryptography>=1.3.4; extra == "security"->requests[security]) (1.11.0) Requirement already satisfied: pycparser in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography>=1.3.4; extra == "security"->requests[security]) (2.18) polyaxon 0.0.33 has requirement numpy==1.13.1, but you'll have numpy 1.14.5 which is incompatible. polyaxon-schemas 0.0.15 has requirement numpy==1.13.1, but you'll have numpy 1.14.5 which is incompatible. nbconvert 5.3.1 has requirement nbformat>=4.4, but you'll have nbformat 4.3.0 which is incompatible. kubernetes 3.0.0 has requirement websocket-client<=0.40.0,>=0.32.0, but you'll have websocket-client 0.48.0 which is incompatible. bittrex-websocket 1.0.6.2 has requirement requests[security]==2.18.4, but you'll have requests 2.19.1 which is incompatible.
Just set up a clean new install in a fresh venv, same issue:
(venv) Davids-MacBook-Pro:accounting david$ python market_monitor.py
2018-08-30 17:25:50 - bittrex_websocket.websocket_client - INFO - Establishing connection to Bittrex through https://socket.bittrex.com/signalr.
2018-08-30 17:25:51 - bittrex_websocket.websocket_client - ERROR -
Unhandled Exception = <class 'ssl.SSLError'>, Message = <[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)>.
Auto-reconnection is disabled for unhandled exceptions.
Report to https://github.com/slazarov/python-bittrex-websocket.
I installed requests and requests[security]. Thanks,
David
Hey David, let's do the following so at least we could replicate each other: Note: I am using python3.7 in this case.
mkdir ~/test
cd ~/test
virtualenv venv/.
source venv/bin/activate
curl https://raw.githubusercontent.com/slazarov/python-bittrex-websocket/master/examples/ticker_updates.py -o ticker_updates.py
python ticker_updates.py
I get the following output, what do you get?
(venv) bash-3.2$ python ticker_updates.py
2018-08-30 12:30:21 - bittrex_websocket.websocket_client - INFO - Establishing connection to Bittrex through https://socket.bittrex.com/signalr.
2018-08-30 12:30:23 - bittrex_websocket.websocket_client - INFO - Successfully subscribed to [SubscribeToExchangeDeltas] for [BTC-ETH].
2018-08-30 12:30:23 - bittrex_websocket.websocket_client - INFO - Successfully subscribed to [SubscribeToExchangeDeltas] for [BTC-NEO].
2018-08-30 12:30:23 - bittrex_websocket.websocket_client - INFO - Successfully subscribed to [SubscribeToExchangeDeltas] for [BTC-ZEC].
2018-08-30 12:30:23 - bittrex_websocket.websocket_client - INFO - Successfully subscribed to [SubscribeToExchangeDeltas] for [ETH-NEO].
2018-08-30 12:30:23 - bittrex_websocket.websocket_client - INFO - Successfully subscribed to [SubscribeToExchangeDeltas] for [ETH-ZEC].
Just received market update for BTC-NEO.
Just received market update for ETH-ZEC.
Just received market update for BTC-ZEC.
Just received market update for BTC-ETH.
Just received market update for ETH-NEO.
We have received updates for all tickers. Closing...
2018-08-30 12:30:25 - bittrex_websocket.websocket_client - INFO - Bittrex connection successfully closed.
That worked. The one thing I had to do that wasn't in your instructions was pip install bittrex_websocket. After doing that, I got this:
(venv) Davids-MacBook-Pro:test david$ python ticker_updates.py
2018-08-30 19:38:14 - bittrex_websocket.websocket_client - INFO - Establishing connection to Bittrex through https://socket.bittrex.com/signalr.
2018-08-30 19:38:18 - bittrex_websocket.websocket_client - INFO - Successfully subscribed to [SubscribeToExchangeDeltas] for [BTC-ETH].
2018-08-30 19:38:18 - bittrex_websocket.websocket_client - INFO - Successfully subscribed to [SubscribeToExchangeDeltas] for [BTC-NEO].
2018-08-30 19:38:18 - bittrex_websocket.websocket_client - INFO - Successfully subscribed to [SubscribeToExchangeDeltas] for [BTC-ZEC].
2018-08-30 19:38:18 - bittrex_websocket.websocket_client - INFO - Successfully subscribed to [SubscribeToExchangeDeltas] for [ETH-NEO].
2018-08-30 19:38:18 - bittrex_websocket.websocket_client - INFO - Successfully subscribed to [SubscribeToExchangeDeltas] for [ETH-ZEC].
Just received market update for ETH-ZEC.
Just received market update for BTC-NEO.
Just received market update for BTC-ETH.
Just received market update for BTC-ZEC.
Just received market update for ETH-NEO.
We have received updates for all tickers. Closing...
2018-08-30 19:38:20 - bittrex_websocket.websocket_client - INFO - Bittrex connection successfully closed.
So definitely and issue with my environment, including the new one i installed. Going to try an uninstall and reinstall. Thanks for your help.
Glad that it's working. Upon solving your issue, please leave a note here for future reference.
With respect to installation, check this page: https://python-bittrex-websocket-docs.readthedocs.io/en/latest/installation.html
Note: Usually the GitHub versions are slightly ahead in terms of commits than the PyPi versions..
Hi there,
I don't have the same error, but I feel it's relevant to this topic
One thing to note - I am using commit I followed your above instructions and ran python ticker_updates.py and got this
(venv) tapestry140:collina bogdan.culda$ venv/bin/python3 ticker_updates.py
2018-08-30 17:01:49 - bittrex_websocket.websocket_client - INFO - Establishing connection to Bittrex through https://socket.bittrex.com/signalr.
2018-08-30 17:01:49 - bittrex_websocket.websocket_client - INFO - cfscrape detected, will try to bypass Cloudflare if enabled.
2018-08-30 17:01:50 - bittrex_websocket.websocket_client - ERROR -
Unhandled Exception = <class 'gevent.hub.LoopExit'>, Message = <('This operation would block forever', <Hub at 0x105b54f20 select pending=0 ref=0>)>.
Auto-reconnection is disabled for unhandled exceptions.
Report to https://github.com/slazarov/python-bittrex-websocket.
2018-08-30 17:01:59 - bittrex_websocket.websocket_client - ERROR - Connection timeout after 10 seconds. Sending a reconnection signal.
Exception in thread ControlQueueThread:
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/Users/bogdan.culda/Desktop/workspace/collina/venv/lib/python3.6/site-packages/bittrex_websocket/websocket_client.py", line 80, in control_queue_handler
self._handle_subscribe(event)
File "/Users/bogdan.culda/Desktop/workspace/collina/venv/lib/python3.6/site-packages/bittrex_websocket/websocket_client.py", line 182, in _handle_subscribe
self.invokes.append({'invoke': event.invoke, 'ticker': identify_payload(event.payload)})
Any thougths ? Thanks
OK my mistake - I've recreated my environment from scratch and it's fixed now.
I've not yet solved this, but I've noted something towards it. The virtualenv command seems to have set up a python 2.7 environment, and then doing pip install bittrex-websocket installed everything I needed. When I'm trying to do my actual development environment, I'm creating it with python3 -m venv venv. This creates a python 3.6 environment. In there if I run pip install bittrex-websocket, I get the issue I've had all along. So some dependancy that is needed to get this to work in python 3 seems to be missing. Not sure what it is yet though.
Forgot to mention, I used python3 / pip3 to install everything as well.
has anyone solved this? I'm getting the same error since yesterday... Didn't change anything.
SSL handshake failed on verifying the certificate protocol: <asyncio.sslproto.SSLProtocol object at 0x14434D90> transport: <_SelectorSocketTransport fd=1572 read=polling write=<idle, bufsize=0>> Traceback (most recent call last): File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\asyncio\sslproto.py", line 625, in _on_handshake_complete raise handshake_exc File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\asyncio\sslproto.py", line 189, in feed_ssldata self._sslobj.do_handshake() File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 763, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1051) SSL error in data received
Run it in a clear venv. You shouldn’t be getting asyncio errors, this library does not support asyncio.
oh sry, I'm using bittrex-websocket-aio. Wrong thread ...
I tried running it in a clear env, I get the same thing. Literally didn't change or do anything in the past 2 days. Tried running it last night and got this. Also, reinstalled python to 3.7.2, same
Complete error:
SSL handshake failed on verifying the certificate protocol: <asyncio.sslproto.SSLProtocol object at 0x12D09CF0> transport: <_SelectorSocketTransport fd=1336 read=polling write=<idle, bufsize=0>> Traceback (most recent call last): File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\asyncio\sslproto.py", line 625, in _on_handshake_complete raise handshake_exc File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\asyncio\sslproto.py", line 189, in feed_ssldata self._sslobj.do_handshake() File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 763, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056) SSL error in data received protocol: <asyncio.sslproto.SSLProtocol object at 0x12D09CF0> transport: <_SelectorSocketTransport closing fd=1336 read=idle write=<idle, bufsize=0>> Traceback (most recent call last): File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\asyncio\sslproto.py", line 526, in data_received ssldata, appdata = self._sslpipe.feed_ssldata(data) File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\asyncio\sslproto.py", line 189, in feed_ssldata self._sslobj.do_handshake() File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 763, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056) Exception in thread SocketConnectionThread: Traceback (most recent call last): File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 917, in _bootstrap_inner self.run() File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 865, in run self._target(*self._args, **self._kwargs) File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\site-packages\bittrex_websocket\websocket_client.py", line 82, in _connection_handler self.connection.conn.start() File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\site-packages\signalr_aio_connection.py", line 36, in start self.transport.start() File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\site-packages\signalr_aio\transports_transport.py", line 47, in start self.ws_loop.run_until_complete(self.socket(self.ws_loop)) File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\asyncio\base_events.py", line 584, in run_until_complete return future.result() File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\site-packages\signalr_aio\transports_transport.py", line 59, in socket loop=loop) as self.ws: File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\site-packages\websockets\py35\client.py", line 2, in aenter return await self File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\site-packages\websockets\py35\client.py", line 12, in await_impl__ transport, protocol = await self._creating_connection File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\asyncio\base_events.py", line 986, in create_connection ssl_handshake_timeout=ssl_handshake_timeout) File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\asyncio\base_events.py", line 1014, in _create_connection_transport await waiter File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\asyncio\sslproto.py", line 526, in data_received ssldata, appdata = self._sslpipe.feed_ssldata(data) File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\asyncio\sslproto.py", line 189, in feed_ssldata self._sslobj.do_handshake() File "C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 763, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)
Anyways try running it in a clean venv. Also can you try a Linux/OS X env to see it it works?
On Jan 20, 2019 at 3:14 pm, <goshetovan (mailto:notifications@github.com)> wrote:
oh sry, I'm using bittrex-websocket-aio. Wrong thread ...
— You are receiving this because you commented. Reply to this email directly, view it on GitHub (https://github.com/slazarov/python-bittrex-websocket/issues/73#issuecomment-455865607), or mute the thread (https://github.com/notifications/unsubscribe-auth/AbVUG_-l-DKaaqc3ApObWdeg0zeAvIeCks5vFGvNgaJpZM4VSFRJ).
I tried running it in a clear venv, same results. What could be the reason for sudden certificate error? I guess it is a local issue, but really don't know where to start searching. The command that lists the python certificates path gives this:
python -c "import ssl; print(ssl.get_default_verify_paths())" DefaultVerifyPaths(cafile=None, capath=None, openssl_cafile_env='SSL_CERT_FILE', openssl_cafile='C:\Program Files (x86)\Common Files\SSL/cert.pem', openssl_capath_env='SSL_CERT_DIR', openssl_capath='C:\Program Files (x86)\Common Files\SSL/certs')
These directories don't exist.
It seems that this made it work again:
(1) I created two new user environment variables:
(2) Created SSL directory in C:\Program Files (x86)\Common Files\ (3) Created certs directory in C:\Program Files (x86)\Common Files\SSL (4) installed certifi with pip install certifi (5) Found the pem file from certifi:
import certifi certifi.where() 'C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\site-packages\certifi\cacert.pem'
(6) Copied the cacert.pem file to C:\Program Files (x86)\Common Files\SSL/ directory. (7) Changed its name to cert.pem
I don't know much about certificates or SSL, but it seems that python somehow lost its information about certificates.
Now it works, cheers!
The library is self contained, you actually don’t have to install any dependencies on your own. Glad it started working though.
On Jan 20, 2019 at 4:22 pm, <goshetovan (mailto:notifications@github.com)> wrote:
It seems that this made it work again:
I created two new user environment variables: (1)
SSL_CERT_DIR with path to C:\Program Files (x86)\Common Files\SSL\certs
SSL_CERT_FILE C:\Program Files (x86)\Common Files\SSL/cert.pem
(2) Created SSL folder in C:\Program Files (x86)\Common Files (3) Created certs folder in C:\Program Files (x86)\Common Files\SSL (4) installed certifi with pip install certifi (5) Found the pem file from certifi:
import certifi certifi.where() 'C:\Users\gos\AppData\Local\Programs\Python\Python37-32\lib\site-packages\certifi\cacert.pem'
(6) Copied the cacert.pem file to C:\Program Files (x86)\Common Files\SSL/ directory. (7) Changed its name to cert.pem
I don't know much about certificates or SSL, but it seems that python somehow lost its information about certificates.
Now it works, cheers!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub (https://github.com/slazarov/python-bittrex-websocket/issues/73#issuecomment-455870511), or mute the thread (https://github.com/notifications/unsubscribe-auth/AbVUG4wsWpMM7u0YQv5xLkolGSj_Ej3xks5vFHu_gaJpZM4VSFRJ).
I'm getting the same error message as well. I tried running the example ticker_updates.py and get the following error messages.
I also created a new venv, and did pip install bittrex_websocket. Still getting the same error message.
python ticker_updates.py 2019-01-21 20:12:49 - bittrex_websocket.websocket_client - INFO - Establishing connection to Bittrex through https://socket.bittrex.com/signalr. 2019-01-21 20:12:50 - bittrex_websocket.websocket_client - ERROR - Unhandled Exception = <class 'ssl.SSLError'>, Message = <[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748)>. Auto-reconnection is disabled for unhandled exceptions. Report to https://github.com/slazarov/python-bittrex-websocket. 2019-01-21 20:12:59 - bittrex_websocket.websocket_client - ERROR - Connection timeout after 10 seconds. Sending a reconnection signal. Exception in thread ControlQueueThread: Traceback (most recent call last): File "C:\Users\michael.kang\AppData\Local\Programs\Python\Python36\lib\threading.py", line 916, in _bootstrap_inner self.run() File "C:\Users\michael.kang\AppData\Local\Programs\Python\Python36\lib\threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "C:\Users\michael.kang\AppData\Local\Programs\Python\Python36\lib\site-packages\bittrex_websocket\websocket_client.py", line 80, in control_queue_handler self._handle_subscribe(event) File "C:\Users\michael.kang\AppData\Local\Programs\Python\Python36\lib\site-packages\bittrex_websocket\websocket_client.py", line 184, in _handle_subscribe self.invokes.append({'invoke': event.invoke, 'ticker': identify_payload(event.payload)}) AttributeError: 'CloseEvent' object has no attribute 'invoke'
I've suddenly started getting this too, have had my program running 24/7 for months and months without issue until now. Very strange! Haven't changed my python env in any way recently either.
I can confirm that the steps provided by @goshetovan appear to fix the problem for me. Perhaps it's an issue with the default SSL certificates, I recall seeing a similar issue in the CCXT library.
I can confirm that the steps provided by @goshetovan appear to fix the problem for me. Perhaps it's an issue with the default SSL certificates, I recall seeing a similar issue in the CCXT library.
Thanks. I'll try those steps as well.
I will look into this. Glad you found a workaround.
@slazarov The SSL issue for python2.7 could be fixed by passing sslopt parameter with ssl.CERT_NONE.
self.ws = create_connection(ws_url, header=self.__get_headers(), cookie=self.__get_cookie_str(), sslopt={"cert_reqs": ssl.CERT_NONE}, enable_multithread=True)
You can update your signalr library to solve the SSL issue. Just update file in signalr/transports/_ws_transport.py. btw, do not forget import ssl.
Thanks for your work for bittrex websocket!
With a cut and paste of this example: https://github.com/slazarov/python-bittrex-websocket/blob/master/examples/ticker_updates.py
I'm getting the following:
2018-07-17 12:25:53 - bittrex_websocket.websocket_client - INFO - Establishing connection to Bittrex through https://socket.bittrex.com/signalr. 2018-07-17 12:25:53 - bittrex_websocket.websocket_client - INFO - cfscrape detected, will try to bypass Cloudflare if enabled. 2018-07-17 12:25:53 - bittrex_websocket.websocket_client - ERROR - Unhandled Exception = <class 'ssl.SSLError'>, Message = <[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)>. Auto-reconnection is disabled for unhandled exceptions. Report to https://github.com/slazarov/python-bittrex-websocket.
I tried to see if it's possible to pass in some SSL verification options, but it seems not looking at the code. Any suggestions?