-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cookie #2082
Comments
I was lazy and rushing it, that's all. #1084 |
Thanks for the info. It is understandable when you have too many things to work on a project. I have little knowledge of Python. Otherwise, I would submit a pull request for a related change. |
If you use yfinance regularly, you probably have enough Python knowledge. |
I haven't run it yet while studying the code. I see the following code for CSRF |
|
The basic cookie approach works fine for their API accesses, with a couple of exceptions. I get the 401 error "not sign in yet" for this end-point https://query1.finance.yahoo.com/v7/finance/download/... I can't find the sign-in URL or account setup. Also, there are other ways to obtain cookies. In addition to A3, the cookies, A1 and A1s, also can be obtained. I haven't noticed what the two additional cookies bring to me. |
Describe bug
To my understanding of the Python code, once a fetched cookie is over 24 hours, the cookie is marked as invalid in the code. It will refresh the cookie when it is older than 24 hours.
Here is a header I get from the fc.yahoo.com end point:
Date: Thu, 10 Oct 2024 18:23:25 GMT
Connection: keep-alive
Server: ATS
Cache-Control: no-store
Content-Type: text/html
Content-Language: en
Set-Cookie: ...; Expires=Sat, 11 Oct 2025 00:23:25 GMT; Max-Age=31557600; Domain=.yahoo.com; Path=/; SameSite=None; Secure; HttpOnly
Content-Length: 4744
The above header contains an expiration date. I wonder why the expiration date isn't used to determine whether refreshing the cookie is needed. Do I miss something?
Simple code that reproduces your problem
Periodically refresh, 24 hours seems fair.
Debug log
NA
Bad data proof
No response
yfinance
version0.2.44
Python version
No response
Operating system
No response
The text was updated successfully, but these errors were encountered: