alvarobartt / investpy

Financial Data Extraction from Investing.com with Python
https://investpy.readthedocs.io/
MIT License
1.59k stars 375 forks source link

Getting ERR#0004 everytime using the function #328

Closed kevin-setiawan closed 3 years ago

kevin-setiawan commented 3 years ago

Hello I encounter a problem just today when I am using the command which retrieves data from investing. com Yesterday it runs alright without any problem. I tried using 2 different command :

  1. stocks_data_df = investpy.get_stock_historical_data(stock='BBVA', country='spain', from_date='01/01/2018', to_date='01/01/2019') and I get this result : File "C:\Users\G40.80\Anaconda3\lib\site-packages\investpy\stocks.py", line 613, in get_stock_historical_data

RuntimeError: ERR#0004: data retrieval error while scraping.

  1. result = investpy.get_stock_information('bbca','indonesia') and I get this result :

    File "C:\Users\G40.80\Anaconda3\lib\site-packages\investpy\stocks.py", line 1133, in get_stock_information elif value.contains('T'):

RuntimeError: ERR#0004: data retrieval error while scraping.

Thankyou.

TradeForce-AI commented 3 years ago

I think they changed something on the website and the scraper fails everytime.. hopefully the developer will fix the issue soon..

pourquoi42 commented 3 years ago

Same Problem for me. It worked the day before. No code changes, no change of version of investpy. Today it doesnt work any more.

investpy 1.0.4

python3.6/site-packages/investpy/indices.py",` line 606, in get_index_historical_data
raise RuntimeError("ERR#0004: data retrieval error while scraping.")
danilogalisteu commented 3 years ago

I wrote about a solution to this on #327. You can make the changes manually until the fix is implemented, by removing the br encoding option from the header field Accept-Encoding.

Dogsbreath1 commented 3 years ago

I wrote about a solution to this on #327. You can make the changes manually until the fix is implemented, by removing the br encoding option from the header field Accept-Encoding.

Many thanks! I removed the all br's in search.py, search._obj.py and etfs.py and now up and running! Before: "Accept-Encoding": "gzip, deflate, br", After: "Accept-Encoding": "gzip, deflate",

alvarobartt commented 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.

alvarobartt commented 3 years ago

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! 👍🏻

alvarobartt commented 3 years ago

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!