-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Describe bug
I am using yfinance.Ticker class to fetch upgrades_downgrades for a stock. Getting "HTTP error 401" for this. This worked fine yesterday. Seems to be something from last evening. I don't access this very frequently, maybe once or twice a day, so does not appear to be rate based blocking etc. I have able to see the data at Yahoo Finance website as well.
Simple code that reproduces your problem
import yfinance as yf
print(yf.__version__)
yf.enable_debug_mode()
df = yf.Ticker(symbol).upgrades_downgrades.reset_index()
Debug log from yf.enable_debug_mode()
0.2.63
DEBUG get_raw_json(): https://query2.finance.yahoo.com/v10/finance/quoteSummary/AMZN
DEBUG Entering get()
DEBUG Entering _make_request()
DEBUG url=https://query2.finance.yahoo.com/v10/finance/quoteSummary/AMZN
DEBUG params={'modules': 'upgradeDowngradeHistory', 'corsDomain': 'finance.yahoo.com', 'formatted': 'false', 'symbol': 'AMZN'}
DEBUG Entering _get_cookie_and_crumb()
DEBUG cookie_mode = 'basic'
DEBUG Entering _get_cookie_and_crumb_basic()
DEBUG Entering _get_cookie_basic()
DEBUG Entering _load_cookie_curlCffi()
DEBUG Exiting _load_cookie_curlCffi()
DEBUG reusing persistent cookie
DEBUG Exiting _get_cookie_basic()
DEBUG Entering _get_crumb_basic()
DEBUG Entering _get_cookie_basic()
DEBUG reusing cookie
DEBUG Exiting _get_cookie_basic()
DEBUG crumb = '75nzMgqhILN'
DEBUG Exiting _get_crumb_basic()
DEBUG Exiting _get_cookie_and_crumb_basic()
DEBUG Exiting _get_cookie_and_crumb()
DEBUG response code=401
DEBUG toggling cookie strategy basic -> csrf
DEBUG Entering _get_cookie_and_crumb()
DEBUG cookie_mode = 'csrf'
DEBUG Entering _get_crumb_csrf()
DEBUG Entering _get_cookie_csrf()
DEBUG Entering _load_cookie_curlCffi()
DEBUG Exiting _load_cookie_curlCffi()
DEBUG reusing persistent cookie
DEBUG Exiting _get_cookie_csrf()
DEBUG crumb = '75nzMgqhILN'
DEBUG Exiting _get_crumb_csrf()
DEBUG Exiting _get_cookie_and_crumb()
DEBUG response code=401
DEBUG Exiting _make_request()
DEBUG Exiting get()
ERROR HTTP Error 401:
Bad data proof
No response
yfinance version
0.2.63
Python version
3.13.4
Operating system
ProductName:macOS ProductVersion:15.4.1 BuildVersion:24E263