pandas-datareader
pandas-datareader copied to clipboard
ConnectionError: HTTPSConnectionPool(host='finance.yahoo.com', port=443): Read timed out.
I have written a simple code to get data of a stock.
import numpy as np import pandas as pd import pandas_datareader as pdr
pdr.get_data_yahoo('RELIANCE.NS').tail()
But this is throwing up a connection error after a few seconds..These codes were working fine last week.I have tried restarting the kernel and browser window.I am able to access the Yahoo Fianace site on the browser.Yet the cal from Python return the error
ConnectionError: HTTPSConnectionPool(host='finance.yahoo.com', port=443): Read timed out.
Can someone please explain why?
getting a similar error with Tiingo
for t in tickers: start_time = time.time()
print(t)
temp_df = pdr.get_data_tiingo(t, api_key=TIINGO_API_KEY, pause=TIINGO_PAUSE, retry_count=TIINGO_RETRY)
time.sleep(2)
ConnectionError: HTTPSConnectionPool(host='api.tiingo.com', port=443): Max retries exceeded with url: /tiingo/daily/AAPL/prices?startDate=2015-12-12&endDate=2020-12-10&format=json (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x132bda9d0>: Failed to establish a new connection: [Errno 60] Operation timed out'))
Your code is fine. The problem is in Yahoo side, don't worry, wait a minute and try again, you can connect to Yahoo.