jadchaar / sec-edgar-downloader

📈 Download filings from the SEC EDGAR database using Python
https://sec-edgar-downloader.readthedocs.io
MIT License
491 stars 137 forks source link

downloading certain filings that ends with zero doesn't work #134

Closed hassan-saadi closed 10 months ago

hassan-saadi commented 10 months ago

I tried to download a filing like this:

cik = "1037540" dl.get("8-K", cik, after="2023-10-01", before="2023-12-31")

Or like this

cik = "0001037540" dl.get("8-K", cik, after="2023-10-01", before="2023-12-31")

Or like this

ticker = "BXP" dl.get("8-K", ticker, after="2023-10-01", before="2023-12-31")

and I got this error: Error occurred while downloading filing for accession number {}: {} 0001656423-23-000045 404 Client Error: Not Found for url: https://www.sec.gov/Archives/edgar/data/103754/000165642323000045/0001656423-23-000045.txt

The ticker "BXP" is associated in reality with cik "1037540".

The file actually does exist in this link: https://www.sec.gov/Archives/edgar/data/1037540/000165642323000045/0001656423-23-000045.txt

The difference is that when the CIK number ends with a zero (the last zero on the right) the link that works has the last zero "data/1037540/", but the link that's provided in the error doesn't have the zero "data/103754/", hence the link wasn't found.

Can you fix this bug asap please? Thank you.

jadchaar commented 10 months ago

Hi @hassan-saadi what version of this package you are using? Mind updating to the latest version? I am not seeing this error and successfully download 2 8-K files when attempting the following on v5.0.2:

cik = "1037540"
dl.get("8-K", cik, after="2023-10-01", before="2023-12-31")
hassan-saadi commented 10 months ago

Updating the package solved the problem. Thanks.