0

I am using ccxt to connect biance to fetch market, then raise error

 SSLEOFError                               Traceback (most recent call last)
E:\Anaconda3\envs\quant\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
    695             if is_new_proxy_conn and http_tunnel_required:
--> 696                 self._prepare_proxy(conn)
    697 

E:\Anaconda3\envs\quant\lib\site-packages\urllib3\connectionpool.py in _prepare_proxy(self, conn)
    963 
--> 964         conn.connect()
    965 

E:\Anaconda3\envs\quant\lib\site-packages\urllib3\connection.py in connect(self)
    363             if self.tls_in_tls_required:
--> 364                 conn = self._connect_tls_proxy(hostname, conn)
    365                 tls_in_tls = True

E:\Anaconda3\envs\quant\lib\site-packages\urllib3\connection.py in _connect_tls_proxy(self, hostname, conn)
    500         # certificate validation
--> 501         socket = ssl_wrap_socket(
    502             sock=conn,

E:\Anaconda3\envs\quant\lib\site-packages\urllib3\util\ssl_.py in ssl_wrap_socket(sock, keyfile, certfile, cert_reqs, ca_certs, server_hostname, ssl_version, ciphers, ssl_context, ca_cert_dir, key_password, ca_cert_data, tls_in_tls)
    452     else:
--> 453         ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
    454     return ssl_sock

E:\Anaconda3\envs\quant\lib\site-packages\urllib3\util\ssl_.py in _ssl_wrap_socket_impl(sock, ssl_context, tls_in_tls, server_hostname)
    494     else:
--> 495         return ssl_context.wrap_socket(sock)

E:\Anaconda3\envs\quant\lib\ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
    499         # ctx._wrap_socket()
--> 500         return self.sslsocket_class._create(
    501             sock=sock,

E:\Anaconda3\envs\quant\lib\ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)
   1039                         raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
-> 1040                     self.do_handshake()
   1041             except (OSError, ValueError):

E:\Anaconda3\envs\quant\lib\ssl.py in do_handshake(self, block)
   1308                 self.settimeout(None)
-> 1309             self._sslobj.do_handshake()
   1310         finally:

SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1129)

My enviroment is based on Anaconda, I created an env to develop, this is detail, python 3.9.7.

enter image description here

I have tried this, but not work, my tls is 1.3, and below not works too, I have been stuck on this for some days. Could someone help me? Thanks!

pip install ndg-httpsclient
pip install pyopenssl
pip install pyasn1
mao fw
  • 1
  • 2

2 Answers2

0

I have no idea what VPN this is, but it looks like that it is messing with the traffic.

This behavior is for example typical when using a company VPN, which also means to use the companies filtering when accessing the internet. Often Deep Packet Inspection is implemented here to control and limit access, and this can result in deliberately breaking outgoing connections.

Steffen Ullrich
  • 114,247
  • 10
  • 131
  • 172
  • Thanks for your answer, I used v2ray as VPN, but it worked before when I used anacond2, then I reinstalled my computer, and install anacond3, and now cannot work. – mao fw Oct 28 '21 at 07:13
  • @maofw: v2ray sounds from the description more like a proxy to me, not a VPN. Are you sure you are using a VPN and not a proxy? Do you have any settings for http_proxy/https_proxy? – Steffen Ullrich Oct 28 '21 at 09:50
  • Yes, should be a proxy tool, my code setting like that ` import os proxy = '127.0.0.1:10808' os.environ["http_proxy"] = "http://"+proxy os.environ["https_proxy"] = "https://"+proxy ` and got 'EOF occurred in violation of protocol (_ssl.c:1129)'))) – mao fw Oct 28 '21 at 10:05
  • @maofw: the proxy setting is wrong. Schema should be `http://` for both http_proxy and https_proxy. Duplicate to existing questions. – Steffen Ullrich Oct 28 '21 at 11:16
0

I fallback urllib3 version to 1.25.11, then it is solved. I read here and it works.

mao fw
  • 1
  • 2