Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConnectionError: ERR#0015: error 429, try again later #467

Closed
Ashabat1 opened this issue Nov 3, 2021 · 10 comments
Closed

ConnectionError: ERR#0015: error 429, try again later #467

Ashabat1 opened this issue Nov 3, 2021 · 10 comments
Assignees
Labels
investing-error Investing.com related error/bug

Comments

@Ashabat1
Copy link

Ashabat1 commented Nov 3, 2021

I keep getting the following message:
ConnectionError: ERR#0015: error 429, try again later.

@alvarobartt alvarobartt self-assigned this Nov 3, 2021
@alvarobartt alvarobartt added the investing-error Investing.com related error/bug label Nov 3, 2021
@alvarobartt alvarobartt added this to the investpy v1.0.8 milestone Nov 3, 2021
@alvarobartt
Copy link
Owner

Hi @Ashabat1, could you please provide me with more information about it? Like the investpy function that you are calling, the parameters, etc., and also some other information if possible like the region you are sending the requests from. As the HTTP 429 error code states that you may have exceeded the limitations of the Investing.com and, so on, you have been blocked from it 😩

@Ashabat1
Copy link
Author

Ashabat1 commented Nov 3, 2021

Thank you for the quick response.
Function: investpy.get_stock_historical_data
Parameter: South Africa Exchanges companies
Country: South Africa

What are exactly the limitations? Is it the number of requests?

@alvarobartt
Copy link
Owner

Thanks for your response, I'm not getting that error, anyway, I'll try to run some stress tests in order to estimate a little bit better which are the limitations of Investing.com, so that I can give you at least a number of supported requests per hour or something similar!

In the meantime, you could try using a different IP to see whether that works or not, so as to clearly spot that the issue with Investing.com is the rate limitation.

@Ashabat1
Copy link
Author

Ashabat1 commented Nov 3, 2021

I have done some tests. I fix it by setting up the time.sleep(10) between the calls. Thank you @alvarobartt

@arielmeragelman
Copy link

I have done some tests. I fix it by setting up the time.sleep(10) between the calls. Thank you @alvarobartt

Could you please tell us how much time you have to wait until get again the response from the api
Did it work from the same IP?
Im having the same issue
Thanks

@ymyke
Copy link
Contributor

ymyke commented Nov 5, 2021

I had the same issue. Using a VPN to change my IP address helps to "start clean" again.

In my case, waiting 2'' after each request prevents running in to the issue.

See this also: #149

@ghost
Copy link

ghost commented Nov 7, 2021

I am getting the same error

start_date = '1993-01-01'
end_date = '2020-01-01'

# convert to date objects 
start_date = dt.datetime.strptime(start_date, '%Y-%m-%d').date()
end_date   = dt.datetime.strptime(end_date, '%Y-%m-%d').date()
    
# set correct date format for investpy library 
start_date = start_date.strftime("%d/%m/%Y") 
end_date = end_date.strftime("%d/%m/%Y")

investpy.get_fund_historical_data(fund= 'Baillie Gifford American Fund B Accumulation',
                                       country   = 'united kingdom',
                                       from_date = start_date,
                                       to_date   = end_date)

@arielmeragelman
Copy link

After 2 days It start working again, so I sugest to run que api with time.sleep to avoid get your ip banned, I dont have enought information to say how often you can run it

@ghost
Copy link

ghost commented Nov 17, 2021

I have done some tests. I fix it by setting up the time.sleep(10) between the calls. Thank you @alvarobartt

Can you please put a minimum working example so others can see how you used the sleep function to fix this?

@alvarobartt
Copy link
Owner

@msh855 Should look something similar to:

import investpy
from time import sleep

for _ in range(10):
    _ = investpy.get_stock_historical_data(stock="AAPL", country="United States", from_date="01/01/2010", to_date="01/01/2021")
    sleep(5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investing-error Investing.com related error/bug
Projects
None yet
Development

No branches or pull requests

4 participants