Closed snvv closed 3 years ago
Experiencing the same issue
I tried making requests directly and I'm getting 403 errors (maybe investing is forbidding the search?)
Hi @snvv, @milesziemer, and @Giezzy! ✋🏻
Thanks for reporting this, are you using the latest investpy version? Check this:
>>> import investpy
>>> print(investpy.__version__)
'1.0.6'
As I've run some tests now for different stocks on different countries and it seems to be working fine, I've also run the pytest
tests so as to make sure that all the functionality is working and those tests also passed...
So the issue may be related either with the investpy
version that you are using or that Investing.com limited your IP as this is a known problem, as Investing.com seems to have some restrictions/limits just for the stocks, which means that whenever you send too many requests to the stocks entry point the API blacklists your IP and you are temporarily banned from Investing.com
Let me know whether pip install investpy --upgrade
works for you, and if the error comes from an Investing.com restriction just wait or use a different IP 😩
In order to make this issue clearer in the next release, I'll include custom error messages so as to handle the Investing.com limitations so that the users are aware of which is the issue/error they are running into, as currently there's nothing I can do to ignore the Investing.com limitations over the stock API...
BTW another option may be that the stock that you are querying is failing, so please can you all share the code that you used so that I can reproduce the issue? Thanks again 👍🏻
Thank you alvarobartt The problem was the old investpy version in my PC. In fact the problem caused from minicoda. Regards Sotiris
Hello I tried today to download stock prices and the program failed with the following message:
Traceback (most recent call last):
File "/home/sotnik/untitled0.py", line 19, in
df = investpy.get_stock_recent_data(stock='bbva', country='spain', as_json=False, order='ascending')
File "/home/sotnik/.local/lib/python3.9/site-packages/investpy/stocks.py", line 346, in get_stock_recent_data raise RuntimeError("ERR#0004: data retrieval error while scraping.")
I upgraded investpy to the latest version but the problem remains.
It used to work without any problem.
Is something that I can do about this?
Thank you Sotiris