Closed danilogalisteu closed 3 years ago
Thanks a lot to everyone, especially to @nhlsm and to @danilogalisteu, as the solution they proposed works like a charm. The tests are already running, but once I check everything is OK (besides the Investing.com issues that have nothing to do with investpy), I'll upload the new release mentioning everyone involved in solving it! :fire: Thanks for this awesome support and sorry for my delayed response.
You can install the new-fixed version as it follows:
pip install investpy==1.0.5
Sorry for the inconvenience, seems that Investing.com is applying a lot of changes and under maintenance... Everyone thank both @danilogalisteu and @nhlsm for their awesome support! 👍🏻
Feel free to drop some comments here https://github.com/alvarobartt/investpy/discussions/334 and more information if applicable, such as the IDs of the solved issues and so on, so that I can include all the information into the Release Notes! :hugs: Thank you!
MVE:
results in:
I traced the problem (similar to this) to the fact that Investing.com is returning content compressed with Brotli, which is accepted according to the search headers (
search.py
line 107):but can't be decompressed by the requests package (
search.py
line 127):Additionally, the headers used to retrieve recent or historical data with a SearchObj also contain the
br
accepted encoding (search._obj.py
lines 258 and 279), resulting on an error raised onsearch._obj.py
line 155:So, the solution is to either add
brotli
as a package requirement and register the decoder withrequests
, or remove thebr
accepted encoding insearch.py
line 111,search._obj.py
lines 258 and 279, and others as required.