Random timeouts

Hello,

I’m getting irregular timeout errors in python when my algo is running.
In the beginning, this error occurred once a week and caused lots of problems.
Then it happened more often and at the moment this error comes up a couple of times per hour.
I tried it on three different computers, mac and windows, on two different networks. It’s everywhere the same

Traceback (most recent call last):
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 382, in _make_request
    self._validate_conn(conn)
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
    conn.connect()
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/urllib3/connection.py", line 411, in connect
    self.sock = ssl_wrap_socket(
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/urllib3/util/ssl_.py", line 428, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/urllib3/util/ssl_.py", line 472, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
TimeoutError: [Errno 60] Operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/urllib3/util/retry.py", line 532, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/urllib3/packages/six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 382, in _make_request
    self._validate_conn(conn)
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
    conn.connect()
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/urllib3/connection.py", line 411, in connect
    self.sock = ssl_wrap_socket(
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/urllib3/util/ssl_.py", line 428, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/urllib3/util/ssl_.py", line 472, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
urllib3.exceptions.ProtocolError: ('Connection aborted.', TimeoutError(60, 'Operation timed out'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/user/Workfiles/Python/vs_binance_algo/safety.py", line 22, in <module>
    get_position_abs = abs(float(gp.open_position())) 
  File "/Users/user/Workfiles/Python/vs_binance_algo/get_position_MKR.py", line 8, in open_position
    response = sr.send_signed_request('GET', '/fapi/v2/positionRisk', { "symbol": symbol })
  File "/Users/user/Workfiles/Python/vs_binance_algo/send_requests_MKR.py", line 49, in send_signed_request
    response = dispatch_request(http_method)(**params)
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/requests/sessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/Users/user/.conda/envs/untitled3/lib/python3.8/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', TimeoutError(60, 'Operation timed out'))

How can I deal with that?

Hi. Are you using any library or package for your program? If so, which one is it?

No, I don’t. I program directly with the binance API

please feel free to test on variable environments, like servers from different providers.
Also test on different tech stacks may help to find more info, like Java, nodejs, etc.