I also found that it does work with  curl_cffi

I opened an issue <https://github.com/beancount/beanprice/issues/106>on 
github with my findings

However I found out that it takes bit more than just changing, in yahoo.py:

self.session = requests.Session()

to:

from curl_cffi import requests as curl_requests
self.session = curl_requests.Session(impersonate="chrome")

Because it such a simple replacement one gets an error


File "C:\_code\py\beanprice\beanprice\sources\yahoo.py", line 97, in 
get\_price\_series
result = parse\_response(response)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\_code\py\beanprice\beanprice\sources\yahoo.py", line 42, in 
parse\_response
if response.status\_code != requests.codes.ok:
^^^^^^^^^^^^^^
AttributeError: module 'curl\_cffi.requests' has no attribute 'codes'. Did 
you mean: 'models'?



On Friday, May 9, 2025 at 1:24:33 PM UTC+2 [email protected] wrote:

> The patch is basically changing, in yahoo.py:
>
> self.session = requests.Session()
>
> to:
>
> from curl_cffi import requests as curl_requests
> self.session = curl_requests.Session(impersonate="chrome")
>
> On Fri, May 9, 2025 at 9:37 AM Adrian Utrilla <[email protected]> wrote:
>
>> I've fixed it (uglily) by using https://github.com/lexiforest/curl_cffi 
>> instead of requests.
>>
>> On Fri, May 9, 2025 at 9:32 AM 'Alen Šiljak' via Beancount <
>> [email protected]> wrote:
>>
>>> Yes, I recently started getting 
>>> ```
>>> Received a non-success status: 429 Too Many Requests
>>> ```
>>> from Yahoo with my pricedb tool (
>>> https://github.com/alensiljak/pricedb-rust). Another round of 
>>> tightening, I assume. Or, perhaps, an API change?
>>>
>>> On Friday, 9 May 2025 at 12:34:34 am UTC+2 fin wrote:
>>>
>>>> Chary Ev2geny wrote: 
>>>> > 
>>>> > I also getting similar errors: 
>>>> ... 
>>>>
>>>> Thanks for verifying it isn't just me. :) 
>>>>
>>>>
>>>> fin 
>>>>
>>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Beancount" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To view this discussion visit 
>>> https://groups.google.com/d/msgid/beancount/20bb44dc-01d4-4e43-826c-7ce082a1823en%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/beancount/20bb44dc-01d4-4e43-826c-7ce082a1823en%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/beancount/1ae5b30f-3614-49f0-b0fc-72e51f9a846dn%40googlegroups.com.

Reply via email to