Remote end closed connection without response

See original GitHub issue

Anyone else getting connection disconnect errors? I thought it was me calling the api too many times but Ive done that awhile ago when I first was using the API only and I would actually get a “Too many calls” error telling me that I’m using too much. Now I keep getting this traceback and cant figure out why. It happens right after I have a time.sleep(300) action so any rate limit shouldnt be a problem at that point.

Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\site-packages\urllib3\connectionpool.py", line 387, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\site-packages\urllib3\connectionpool.py", line 383, in _make_request
    httplib_response = conn.getresponse()
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\http\client.py", line 1331, in getresponse
    response.begin()
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\http\client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\http\client.py", line 266, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\site-packages\requests\adapters.py", line 440, in send
    timeout=timeout
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\site-packages\urllib3\connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\site-packages\urllib3\util\retry.py", line 357, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\site-packages\urllib3\packages\six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\site-packages\urllib3\connectionpool.py", line 387, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\site-packages\urllib3\connectionpool.py", line 383, in _make_request
    httplib_response = conn.getresponse()
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\http\client.py", line 1331, in getresponse
    response.begin()
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\http\client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\http\client.py", line 266, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:/Programming Projects/Python Courses/BinanceBot/sidebyhalf.py", line 104, in <module>
    average15m = Binancewebsocket.movingaverage1hr(pair)
  File "D:\Programming Projects\Python Courses\BinanceBot\Binancewebsocket.py", line 23, in movingaverage1hr
    candles = client.get_klines(symbol=pair, interval=client.KLINE_INTERVAL_1MINUTE)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\site-packages\binance\client.py", line 689, in get_klines
    return self._get('klines', data=params)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\site-packages\binance\client.py", line 206, in _get
    return self._request_api('get', path, signed, version, **kwargs)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\site-packages\binance\client.py", line 180, in _request_api
    return self._request(method, uri, signed, **kwargs)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\site-packages\binance\client.py", line 174, in _request
    response = getattr(self.session, method)(uri, **kwargs)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\site-packages\requests\sessions.py", line 521, in get
    return self.request('GET', url, **kwargs)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\site-packages\requests\sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\site-packages\requests\sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\lib\site-packages\requests\adapters.py", line 490, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:14

github_iconTop GitHub Comments

1reaction
martines328commented, Jul 4, 2022

If you use python-binance try this code. while True: try: client = Client(api_key, api_secret) <… your code> client.close_connection() time.sleep(delay)

I know that’s bad practice but it’s working.

0reactions
pulkitsharmacommented, Apr 1, 2022

I was not able to resolve it. Perhaps there should be a auto-retry connection system in place. I haven’t used this library in years. You can look at some other open source binance bots and check how they do it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python HTTP Server/Client: Remote end closed connection ...
RemoteDisconnected: Remote end closed connection without response During handling of the above exception, another exception occurred: ...
Read more >
API Contacts: Remote end closed connection without response
API Contacts: Remote end closed connection without response. Hello people! I'm doing some requests to the Contacts endpoint to get all of my...
Read more >
Issue 41345: Remote end closed connection without response
Issue is that from time to time i'm getting exception from python when sending request to server which has http keepalive option turned...
Read more >
runserver crashes with "Remote end closed connection ...
RemoteDisconnected: Remote end closed connection without response During handling of the above exception, another exception occurred: Traceback (most recent ...
Read more >
Remote end closed connection without response on ... - GitHub
It sounds like it's either not configured to handle the number of requests you're sending without a pause, or there's some other race...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found