Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python connexion error - ConnectionResetError: [WinError 10054] #3

Open
AxelGUILLAUMET opened this issue May 21, 2021 · 3 comments
Open

Comments

@AxelGUILLAUMET
Copy link

Hi!

At the 5th o 6th cycle, this is the error I get:

Traceback (most recent call last):
File "C:\Program Files\Python39\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "C:\Program Files\Python39\lib\site-packages\urllib3\connectionpool.py", line 445, in _make_request
six.raise_from(e, None)
File "", line 3, in raise_from
File "C:\Program Files\Python39\lib\site-packages\urllib3\connectionpool.py", line 440, in _make_request
httplib_response = conn.getresponse()
File "C:\Program Files\Python39\lib\http\client.py", line 1345, in getresponse
response.begin()
File "C:\Program Files\Python39\lib\http\client.py", line 307, in begin
version, status, reason = self._read_status()
File "C:\Program Files\Python39\lib\http\client.py", line 268, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:\Program Files\Python39\lib\socket.py", line 704, in readinto
return self._sock.recv_into(b)
File "C:\Program Files\Python39\lib\ssl.py", line 1241, in recv_into
return self.read(nbytes, buffer)
File "C:\Program Files\Python39\lib\ssl.py", line 1099, in read
return self._sslobj.read(len, buffer)
ConnectionResetError: [WinError 10054] Se ha forzado la interrupción de una conexión existente por el host remoto

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Program Files\Python39\lib\site-packages\requests\adapters.py", line 439, in send
resp = conn.urlopen(
File "C:\Program Files\Python39\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "C:\Program Files\Python39\lib\site-packages\urllib3\util\retry.py", line 532, in increment
raise six.reraise(type(error), error, _stacktrace)
File "C:\Program Files\Python39\lib\site-packages\urllib3\packages\six.py", line 734, in reraise
raise value.with_traceback(tb)
File "C:\Program Files\Python39\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "C:\Program Files\Python39\lib\site-packages\urllib3\connectionpool.py", line 445, in _make_request
six.raise_from(e, None)
File "", line 3, in raise_from
File "C:\Program Files\Python39\lib\site-packages\urllib3\connectionpool.py", line 440, in _make_request
httplib_response = conn.getresponse()
File "C:\Program Files\Python39\lib\http\client.py", line 1345, in getresponse
response.begin()
File "C:\Program Files\Python39\lib\http\client.py", line 307, in begin
version, status, reason = self._read_status()
File "C:\Program Files\Python39\lib\http\client.py", line 268, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:\Program Files\Python39\lib\socket.py", line 704, in readinto
return self._sock.recv_into(b)
File "C:\Program Files\Python39\lib\ssl.py", line 1241, in recv_into
return self.read(nbytes, buffer)
File "C:\Program Files\Python39\lib\ssl.py", line 1099, in read
return self._sslobj.read(len, buffer)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(10054, 'Se ha forzado la interrupción de una conexión existente por el host remoto', None, 10054, None))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Program Files\Python39\lib\site-packages\ccxt\base\exchange.py", line 567, in fetch
response = self.session.request(
File "C:\Program Files\Python39\lib\site-packages\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "C:\Program Files\Python39\lib\site-packages\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "C:\Program Files\Python39\lib\site-packages\requests\adapters.py", line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(10054, 'Se ha forzado la interrupción de una conexión existente por el host remoto', None, 10054, None))

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\supertrend\supertrend.py", line 119, in
schedule.run_pending()
File "C:\Program Files\Python39\lib\site-packages\schedule_init_.py", line 780, in run_pending
default_scheduler.run_pending()
File "C:\Program Files\Python39\lib\site-packages\schedule_init_.py", line 100, in run_pending
self.run_job(job)
File "C:\Program Files\Python39\lib\site-packages\schedule_init
.py", line 172, in run_job
ret = job.run()
File "C:\Program Files\Python39\lib\site-packages\schedule_init
.py", line 661, in run
ret = self.job_func()
File "C:\supertrend\supertrend.py", line 98, in run_bot
bars = exchange.fetch_ohlcv('ETH/USDT', timeframe='5m', limit=50)
File "C:\Program Files\Python39\lib\site-packages\ccxt\binance.py", line 1463, in fetch_ohlcv
response = getattr(self, method)(self.extend(request, params))
File "C:\Program Files\Python39\lib\site-packages\ccxt\base\exchange.py", line 461, in inner
return entry(_self, **inner_kwargs)
File "C:\Program Files\Python39\lib\site-packages\ccxt\binance.py", line 2978, in request
response = self.fetch2(path, api, method, params, headers, body)
File "C:\Program Files\Python39\lib\site-packages\ccxt\base\exchange.py", line 482, in fetch2
return self.fetch(request['url'], request['method'], request['headers'], request['body'])
File "C:\Program Files\Python39\lib\site-packages\ccxt\base\exchange.py", line 619, in fetch
raise NetworkError(details) from e
ccxt.base.errors.NetworkError: binance GET https://api.binance.com/api/v3/klines?symbol=ETHUSDT&interval=5m&limit=50

@AxelGUILLAUMET
Copy link
Author

Found the solution :

schedule.every(5).seconds.do(run_bot)

No should be more than 5 (Ej I put 60 and it think it¿s too more time and there is a lost of the connexion to Binance)

I hope I'm right!

Regards!

@rafalsza
Copy link

I'm getting ConnectionResetError: [Errno 104] Connection reset by peer with schedule.every(5).seconds.do(run_bot) and schedule.every(60).seconds.do(run_bot) also (only on GoogleCloud cause from local machine it;s ok) . Did you solved this issue?

@nanachimi
Copy link

I got this problem after changing the pair "ETH/USD" to something else. To avoid this I just entered my API Key and secret and it works now for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants