alvarobartt / investpy

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

Error 406 encountered when using investpy.get_stock_information #253

Open phenc opened 3 years ago

phenc commented 3 years ago

A "ConnectionError: ERR#0015: error 406, try again later" has started to occur since few hours ago when calling the said function

KIC commented 3 years ago

this is true for the following functions:

while all the other get_*_information functions work as expected. I have the suspicion that the above functions actually has a different problem as the 406 indicates.

alvarobartt commented 3 years ago

Hi @phenc and @KIC! Thank you for reporting this issue 👍🏻

As KIC says those functions tend to throw that concrete exception as somehow Investing.com is limiting the requests just for stock data, which does not make much sense, but AFAIK that's an Investing.com issue that I cannot handle 😩 Some alternative solutions have been proposed such as letting the users define a proxy for the requests module so that those requests do not fail, but anyway this seems to be a tricky thing!

I'll have another look at the code so as to check that there is no difference between the stock requests and all the other financial product ones! I will let you know in a couple of days 🔥

KIC commented 3 years ago

If this is really the case then one might consider using TorPy. For sure this doesn't make things faster but at least we can get the data. And they have a zero external (like tor client) dependency drop-in replacement for the requests library which would make things rather easy from an implementation point of view.

alvarobartt commented 3 years ago

Thanks for the suggestion @KIC I didn't know about this package, I'll give it a try! 👍🏻

alvarobartt commented 3 years ago

BTW @KIC I've just seen your project pandas-ml-quant and I encourage you to include it in the README.md section of this repository in the "Utilities" section, which is basically forking the project, including your project in the list with a short description of the project and your username 👍🏻 Feel free to do it! I'm cool with you including your repository as a featured utility 😄

KIC commented 3 years ago

unfortunately the investpy functionality is currently broken 🙈. but I will fix it soon and update the readme as suggested. thank you very much for the opportunity.