yfinance
yfinance copied to clipboard
No Exception raised when network not available -> requests ConnectionError
When no internet connection is available for some time (10-20s), the program throws ConnectionErrors form request package and stucks on doing nothing and not cointinuing. It seems like no Exception raising/handling is implemented. Please implement this for proper internet outage error handling.
EDIT: can be easily simulated when disconnecting from wifi/ethernet with following code:
import requests
import yfinance as yf
import time
import yfinance.shared as shared
tickerlist = ["MSFT", "TSLA", "BABA", "DE", "BIDU", "FSLY", "REPYY", "CRWD", "NET", "AMD", "BNTX", "CRWD", "WING"]
while True:
for ticker in tickerlist:
try:
data =yf.download(ticker, progress = False) #timeout = 3,
print("Price for " + ticker + " : " + str(data.Close.iloc[-1].round(2)))
except Exception as e:
print(e)
print("Unfortunately no error raising and handling")