dgunning / edgartools

Navigate SEC Edgar data in Python
MIT License
426 stars 84 forks source link

Too many requests #97

Closed david08-08 closed 3 weeks ago

david08-08 commented 3 weeks ago

Is it possible to receive an error for too many requests?

Traceback (most recent call last):

Cell In[24], line 43 if filing.header.form == '10-K' and year in str(filing.filing_date):

File /opt/anaconda3/envs/nlp_env/lib/python3.11/site-packages/edgar/_filings.py:1210 in header sec_header_content = download_text_between_tags(self.text_url, "SEC-HEADER")

File /opt/anaconda3/envs/nlp_env/lib/python3.11/site-packages/edgar/httprequests.py:558 in download_text_between_tags for response in stream_with_retry(url):

File /opt/anaconda3/envs/nlp_env/lib/python3.11/site-packages/edgar/httprequests.py:238 in stream_with_retry raise TooManyRequestsError(url)

TooManyRequestsError: Too Many Requests

dgunning commented 3 weeks ago

Change filing.header.form to filing.form.

Some properties like filing.header make an extra http call to get more data like the header information. The library has a lot of internal safeguards against too many requests but it can sometimes be triggered.

david08-08 commented 3 weeks ago

Thank you Dwight. I was able to resolve this.

dgunning commented 3 weeks ago

Closed as resolved