alvarobartt / investpy

Financial Data Extraction from Investing.com with Python
https://investpy.readthedocs.io/
MIT License
1.59k stars 374 forks source link

Connection Reset Error #553

Open sasi-mohan opened 2 years ago

sasi-mohan commented 2 years ago

Hi,

we are downloading the historical data from investing.com for so many months now. For the past couple of weeks, the extract has been failing 50% of the time with a connection error. I did upgrade to the latest version of the package, and after all the troubleshooting, I found that if I restrict the time frame from 2001 to 2020, I'm able to extract the data with no errors.

Can you please help us understand what could be possibly wrong?

Error message below: Traceback (most recent call last): File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 441, in _error_catcher yield File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 770, in read_chunked chunk = self._handle_chunk(amt) File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 714, in _handle_chunk value = self._fp._safe_read(amt) File "/opt/rh/rh-python38/root/lib64/python3.8/http/client.py", line 613, in _safe_read data = self.fp.read(amt) File "/opt/rh/rh-python38/root/lib64/python3.8/socket.py", line 669, in readinto return self._sock.recv_into(b) File "/opt/rh/rh-python38/root/lib64/python3.8/ssl.py", line 1241, in recv_into return self.read(nbytes, buffer) File "/opt/rh/rh-python38/root/lib64/python3.8/ssl.py", line 1099, in read return self._sslobj.read(len, buffer) ConnectionResetError: [Errno 104] Connection reset by peer

ymyke commented 2 years ago

What is the code that produces this error?

sasi-mohan commented 2 years ago

Natural_Gas = investpy.get_commodity_historical_data(commodity='Natural Gas',from_date='01/01/2001',to_date='31/12/2025') even this.. Gasoline = investpy.get_commodity_historical_data(commodity='Gasoline RBOB',from_date='01/01/2001',to_date='31/12/2025')

sasi-mohan commented 2 years ago

Sorry, a correction in my initial post: I found that if I restrict the time frame from 2010 to 2020

sasi-mohan commented 2 years ago

Update: I ran the same command on my local machine (windows) and I never got any error. But the same command on the Linux machine (which used to run fine before) is throwing the Connection reset error. Even if I limit the number of years range, still 50% of the time, the fetch is failing.

ymyke commented 2 years ago

Do you have some rather short timeouts configured re networking on your Linux machine that sometimes trigger and sometimes don't?

sasi-mohan commented 2 years ago

nothing of that sort...there was no change in any of the settings...it's been working just fine couple of weeks ago...