alvarobartt / investpy

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

ConnectionError: ERR#0015: error 429, try again later. #489

Closed mrkgoh closed 2 years ago

mrkgoh commented 2 years ago

@alvarobartt ,

Did anyone else, report receiving similar ConnectionError today? I was working fine until 02 Dec 2021 about 11pm Malaysia Time.

Thank you mrkgoh

/volume1/homes/admin/Drive/stock/pri/prices.py in get(self, from_date)
     51         '''
     52         if type(self.symbol) == str:
---> 53             result = self._get_stock_historical_data(
     54                 from_date='01/01/1970' if not from_date else from_date,
     55                 )

/volume1/homes/admin/Drive/stock/utils/utils.py in f_retry(*args, **kwargs)
     63                     mtries -= 1
     64                     mdelay *= backoff
---> 65             return f(*args, **kwargs)
     66         return f_retry  # true decorator
     67     return deco_retry

/volume1/homes/admin/Drive/stock/pri/prices.py in _get_stock_historical_data(self, **kwargs)
     66     ) -> pd.DataFrame:
     67         try:
---> 68             df = ip.get_stock_historical_data(                
     69                 stock=self.symbol,
     70                 country='malaysia',

/volume1/homes/admin/venv/lib/python3.8/site-packages/investpy/stocks.py in get_stock_historical_data(stock, country, from_date, to_date, as_json, order, interval)
    557 
    558         if req.status_code != 200:
--> 559             raise ConnectionError("ERR#0015: error " + str(req.status_code) + ", try again later.")
    560 
    561         if not req.text:

ConnectionError: ERR#0015: error 429, try again later.
mrkgoh commented 2 years ago

I was blocked by investing.com due to accidental multiple rapid queries. Closed the issue.

af20 commented 2 years ago

I have the same issue

mrkgoh commented 2 years ago

I have the same issue

You need to pace your query with investing.com. I applied an auto sleep function for a list of stocks.