Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URLs produced by get_sec_filings() call for authtentication #2222

Open
amgsharma opened this issue Jan 13, 2025 · 2 comments
Open

URLs produced by get_sec_filings() call for authtentication #2222

amgsharma opened this issue Jan 13, 2025 · 2 comments

Comments

@amgsharma
Copy link

amgsharma commented Jan 13, 2025

Describe bug

tech_ticker.get_sec_filings()

404 Client Error: Not Found for url: https://query2.finance.yahoo.com/v10/finance/quoteSummary/%5EYH311?modules=secFilings&corsDomain=finance.yahoo.com&formatted=false&symbol=%5EYH311&crumb=jjGzRrRM4iK

The response from the URL generated by the call is :

{"finance":{"result":null,"error":{"code":"Unauthorized","description":"Invalid Crumb"}}}

Simple code that reproduces your problem

msft = yf.Ticker('MSFT')
tech = yf.Sector(msft.info.get('sectorKey'))


# Sector and Industry to Ticker
tech_ticker = tech.ticker

tech_ticker.get_sec_filings()

Debug log

In [37]: yf.enable_debug_mode()

In [42]: tech_ticker.get_sec_filings()
In [43]: tech_ticker.get_major_holders()
DEBUG get_raw_json(): https://query2.finance.yahoo.com/v10/finance/quoteSummary//^YH311
DEBUG Entering get()
DEBUG Entering _make_request()
DEBUG url=https://query2.finance.yahoo.com/v10/finance/quoteSummary//^YH311
DEBUG params={'modules': 'institutionOwnership,fundOwnership,majorDirectHolders,majorHoldersBreakdown,insiderTransactions,insiderHolders,netSharePurchaseActivity', 'corsDomain': 'finance.yahoo.com', 'formatted': 'false'}
DEBUG Entering _get_cookie_and_crumb()
DEBUG cookie_mode = 'basic'
DEBUG Entering _get_cookie_and_crumb_basic()
DEBUG reusing cookie
DEBUG reusing crumb
DEBUG Exiting _get_cookie_and_crumb_basic()
DEBUG Exiting _get_cookie_and_crumb()
DEBUG response code=404
DEBUG toggling cookie strategy basic -> csrf
DEBUG Entering _get_cookie_and_crumb()
DEBUG cookie_mode = 'csrf'
DEBUG Entering _get_crumb_csrf()
DEBUG Failed to find "csrfToken" in response
DEBUG Exiting _get_crumb_csrf()
DEBUG toggling cookie strategy csrf -> basic
DEBUG Entering _get_cookie_and_crumb_basic()
DEBUG loaded persistent cookie
DEBUG reusing cookie
DEBUG crumb = 'jjGzRrRM4iK'
DEBUG Exiting _get_cookie_and_crumb_basic()
DEBUG Exiting _get_cookie_and_crumb()
DEBUG response code=404
DEBUG Exiting _make_request()
DEBUG Exiting get()
ERROR 404 Client Error: Not Found for url: https://query2.finance.yahoo.com/v10/finance/quoteSummary//%5EYH311?modules=institutionOwnership%2CfundOwnership%2CmajorDirectHolders%2CmajorHoldersBreakdown%2CinsiderTransactions%2CinsiderHolders%2CnetSharePurchaseActivity&corsDomain=finance.yahoo.com&formatted=false&crumb=jjGzRrRM4iK

Bad data proof

No response

yfinance version

0.2.51

Python version

3.11.5

Operating system

Pop OS

@ValueRaider
Copy link
Collaborator

ValueRaider commented Jan 13, 2025

...
DEBUG Entering _get_cookie_and_crumb()
DEBUG cookie_mode = 'basic'
DEBUG Entering _get_cookie_and_crumb_basic()
DEBUG reusing cookie
DEBUG reusing crumb
...

The very first time yfinance needs a crumb since starting, it should be fetching not reusing. Was this a brand new Python session? Are you running in Jupyter?

@dhruvan2006
Copy link
Contributor

This has nothing to do with crumbs.

A sector ticker cannot have SEC Filings...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants