python-bittrex-websocket icon indicating copy to clipboard operation
python-bittrex-websocket copied to clipboard

SSL: CERTIFICATE_VERIFY_FAILED

Open photogadam opened this issue 7 years ago • 7 comments

I've tried the examples in the how to along with ticker.updates.py and the only response I'm receiving is ssl.SSLError. Any suggestions? Thanks in advance.

2018-10-15 20:34:12 - bittrex_websocket.websocket_client - INFO - Establishing connection to Bittrex through https://socket.bittrex.com/signalr.
2018-10-15 20:34:12 - bittrex_websocket.websocket_client - INFO - Successfully subscribed to [SubscribeToExchangeDeltas] for [BTC-ETH].
2018-10-15 20:34:12 - bittrex_websocket.websocket_client - INFO - Successfully subscribed to [SubscribeToExchangeDeltas] for [BTC-NEO].
2018-10-15 20:34:12 - bittrex_websocket.websocket_client - INFO - Successfully subscribed to [SubscribeToExchangeDeltas] for [BTC-ZEC].
2018-10-15 20:34:12 - bittrex_websocket.websocket_client - INFO - Successfully subscribed to [SubscribeToExchangeDeltas] for [ETH-NEO].
2018-10-15 20:34:12 - bittrex_websocket.websocket_client - INFO - Successfully subscribed to [SubscribeToExchangeDeltas] for [ETH-ZEC].
Exception in thread SocketConnectionThread:
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 "/Users/user/Desktop/aio/bittrex_websocket/websocket_client.py", line 82, in _connection_handler
    self.connection.conn.start()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/signalr_aio/_connection.py", line 36, in start
    self.__transport.start()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/signalr_aio/transports/_transport.py", line 47, in start
    self.ws_loop.run_until_complete(self.socket(self.ws_loop))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 467, in run_until_complete
    return future.result()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/signalr_aio/transports/_transport.py", line 59, in socket
    loop=loop) as self.ws:
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websockets/py35/client.py", line 2, in __aenter__
    return await self
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websockets/py35/client.py", line 12, in __await_impl__
    transport, protocol = await self._creating_connection
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 803, in create_connection
    sock, protocol_factory, ssl, server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 829, in _create_connection_transport
    yield from waiter
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/sslproto.py", line 501, in data_received
    ssldata, appdata = self._sslpipe.feed_ssldata(data)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/sslproto.py", line 201, in feed_ssldata
    self._sslobj.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 689, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)

^Z
[1]+  Stopped                 python3 test.py
Userss-MBP:aio user$ cd examples
Users-MBP:examples user$ python3 ticker_updates.py
2018-10-15 20:34:58 - bittrex_websocket.websocket_client - INFO - Establishing connection to Bittrex through https://socket.bittrex.com/signalr.
2018-10-15 20:34:59 - 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-10-15 20:35:08 - 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 182, in _handle_subscribe
    self.invokes.append({'invoke': event.invoke, 'ticker': identify_payload(event.payload)})
AttributeError: 'CloseEvent' object has no attribute 'invoke'

photogadam avatar Oct 16 '18 01:10 photogadam

Check this https://github.com/slazarov/python-bittrex-websocket/issues/73

slazarov avatar Oct 16 '18 05:10 slazarov

Thanks for the reply. I tried your instructions from https://github.com/slazarov/python-bittrex-websocket/issues/73#issuecomment-417256152 (using python3 and instead of python and installed bittrex_websocket through pip3) and this is what I recieved:

(venv) Userss-MBP:test user$ python3 ticker_updates.py
2018-10-16 07:23:36 - bittrex_websocket.websocket_client - INFO - Establishing connection to Bittrex through https://socket.bittrex.com/signalr.
2018-10-16 07:23:36 - bittrex_websocket.websocket_client - ERROR - 
Unhandled Exception = <class 'ssl.SSLCertVerificationError'>, Message = <[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)>.
Auto-reconnection is disabled for unhandled exceptions.
Report to https://github.com/slazarov/python-bittrex-websocket.
2018-10-16 07:23:46 - 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.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/user/test/venv/lib/python3.7/site-packages/bittrex_websocket/websocket_client.py", line 80, in control_queue_handler
    self._handle_subscribe(event)
  File "/Users/user/test/venv/lib/python3.7/site-packages/bittrex_websocket/websocket_client.py", line 182, in _handle_subscribe
    self.invokes.append({'invoke': event.invoke, 'ticker': identify_payload(event.payload)})
AttributeError: 'CloseEvent' object has no attribute 'invoke'

photogadam avatar Oct 16 '18 12:10 photogadam

Just an update, I was able to install this to my raspberry pi and it is working, so I'm not sure what is wrong on my end. Any advice would be helpful.

photogadam avatar Oct 16 '18 19:10 photogadam

Just another update. I reinstalled everything and am still getting the error. I ran across this, but am not sure if it is relevant (I am on osx): https://github.com/slackapi/python-slackclient/issues/334

photogadam avatar Oct 16 '18 20:10 photogadam

Hi, do you get the same error if you run it in a docker instance?

slazarov avatar Oct 31 '18 18:10 slazarov

Hi, do you get the same error if you run it in a docker instance?

I'm not familiar with docker. But I'll try to look into and give it a try for you in the next few days.

photogadam avatar Oct 31 '18 18:10 photogadam

Hi, do you get the same error if you run it in a docker instance?

Docker isn't working in the OSX Mojave update... I have this working in linux and I'll just use it there instead.

photogadam avatar Nov 02 '18 16:11 photogadam