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

Add cookies as a workaround to fix earnings dates #2153

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ForeverZyh
Copy link

As discussed in #1932 , it seems we need to login to apply the filter, so the idea is to add additional cookies to the API. Usage:

yf.Ticker(symbol).get_earnings_dates(add_cookies={
        'T': Your_cookies1,
        'Y': Your_cookies2})

I tested that if we supply T and Y cookies to the requests.get, we can successfully get the desired response.

I asked ChatGPT to see how to get my cookies manually: https://chatgpt.com/share/67453e22-bba0-8013-9d97-b8d320b7e24f in Chrome.

@ValueRaider
Copy link
Collaborator

ValueRaider commented Nov 26, 2024

add_cookies should be higher and pass to data.py. At least up to the Ticker class, and maybe on yfinance itself.

And save it in cache via YfData._save_cookie_basic or a similar function, because manually extracting cookie sounds annoying.

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

Successfully merging this pull request may close these issues.

2 participants