Open csirick2020 opened 4 months ago
Looks like spam - spam less? #1513
Looks like spam - spam less? #1513
I guess it's possible, but it's strange that it just started happening in the last 2 or 3 months. I may have updated my yfinance version in that time, but I can't remember for sure. Anyway, thanks for the advice.
As a side note, when I added error handling to skip past these "misfires", the program will complete it's full cycle through all 503 tickers. It's just a few of them that pull this error.
Describe bug
I have a program that cycles through a list of all the S&P500 companies to check the 'upgrades_downgrades' attribute of each one (with a for loop). It gets the tickers from a well maintained Wikipedia page (scraping with BeautifulSoup4). All the tickers are up to date (I have personally checked), are able to be found on the Yahoo Finance website and are not delisted. All the tickers are in the correct format, as I apply that after they are scraped. While most of the tickers work once the program starts iterating through them, there are a few that have been raising this 404 Client Error since maybe about a month or two ago. Again, the tickers are perfectly fine and the implementation is correct (this is evident in the fact that most of the 503 tickers get a normal response during the iteration). I will provide the full 404 Client Error I receive on some of the symbols in the debug log section.
Simple code that reproduces your problem
The simplest way to reproduce the problem is by putting a couple of the tickers I know are "bad" into a list with a few good ones and making the same type of call on them:
Debug log
404 Client Error: Not Found for url: https://query2.finance.yahoo.com/v10/finance/quoteSummary/COO?modules=upgradeDowngradeHistory&corsDomain=finance.yahoo.com&formatted=false&symbol=COO&crumb=jroCz7O300G
404 Client Error: Not Found for url: https://query2.finance.yahoo.com/v10/finance/quoteSummary/LIN?modules=upgradeDowngradeHistory&corsDomain=finance.yahoo.com&formatted=false&symbol=LIN&crumb=jroCz7O300G
Note: When running the code, the 'General error fetching data for {symbol}: 'RangeIndex' object has no attribute 'date'' that is also raised in these two instances is avoidable, and I don't think it has to do with the 404 Client Error. I did not want to make my code snippet unnecessarily long, but I do avoid that error by using pd.to_datetime() in each iteration. It has no bearing on the 404 Client Error, for which I have tried everything I know how to do and still can't catch or avoid it!
**My apologies for not being more familiar with the logging/debugging process. I've been stuck on this bug for a while today and don't have the bandwidth to figure out the proper way to document this Debug log right now.
Bad data proof
I believe this would be considered the 'bad data':
404 Client Error: Not Found for url: https://query2.finance.yahoo.com/v10/finance/quoteSummary/COO?modules=upgradeDowngradeHistory&corsDomain=finance.yahoo.com&formatted=false&symbol=COO&crumb=jroCz7O300G
404 Client Error: Not Found for url: https://query2.finance.yahoo.com/v10/finance/quoteSummary/LIN?modules=upgradeDowngradeHistory&corsDomain=finance.yahoo.com&formatted=false&symbol=LIN&crumb=jroCz7O300G
yfinance
versionyfinance 0.2.40
Python version
3.10.12
Operating system
LinuxLite (Ubuntu)