Skip to content

Conversation

@irgb
Copy link

@irgb irgb commented May 2, 2025

fix #2422
fix #2429

Your Name added 2 commits May 2, 2025 13:11
ADD: Implement convert_curl_cffi_cookies_to_requests function in utils.py
MODIFY: Update cookie handling in data.py to use the new conversion function
@ValueRaider
Copy link
Collaborator

Interesting, different approach to #2430. Have you tried it?

@irgb
Copy link
Author

irgb commented May 2, 2025

Interesting, different approach to #2430. Have you tried it?

yes, of course

@ValueRaider
Copy link
Collaborator

Something confuses me:

if isinstance(response.cookies, curl_cffi.requests.cookies.Cookies):

How can response.cookies ever be a curl_cffi.requests.cookies.Cookies?

@irgb
Copy link
Author

irgb commented May 2, 2025

Something confuses me:

if isinstance(response.cookies, curl_cffi.requests.cookies.Cookies):

How can response.cookies ever be a curl_cffi.requests.cookies.Cookies?

You passed a curl_cffi session, and passed it to yfinance as discussed in other issues. Then yfinance will use this session to send a request.

@ValueRaider
Copy link
Collaborator

ValueRaider commented May 2, 2025

Gotcha. Fine as a proof-of-concept but not as a release - curl_cffi session needs to be default automatic.

@bretsky
Copy link
Contributor

bretsky commented May 2, 2025

@ValueRaider that can be accomplished fairly easily, just add the self.session = session or requests.Session(impersonate="chrome") lines to this PR and I think it will just work

…rove cookie handling

OPTIMIZE: Use chrome browser impersonation when creating Sessions for better compatibility
MODIFY: Update related class docstrings to reflect the new dependency
@ValueRaider
Copy link
Collaborator

FYI I've merged & released the other PR. As emergency over, switch further work to dev branch.

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.

AttributeError("'str' object has no attribute 'name'") [0.2.57] YFRateLimitError('Too Many Requests

3 participants