I have created a PR which fixes this (at least it works for me) Until the PR is accepted one can try it by installing my code like this
pip install git+https://github.com/Ev2geny/beanprice.git@issue_106 On Friday, May 9, 2025 at 2:16:48 PM UTC+2 Chary Ev2geny wrote: > 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/e400281b-2f66-42de-91eb-44b08bd3458en%40googlegroups.com.
