jadchaar / sec-edgar-downloader

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

Fix bug with trailing 0 in CIK #128

Closed jadchaar closed 1 year ago

jadchaar commented 1 year ago

In the orchestrator, I am using strip("0") to clean the CIK and format the URL for archive download. Filings for CIKs ending with 0 fail to download due to this issue since I am malforming a correct CIK. The fix is to change the orchestrator to clean the CIK using lstrip("0").

In addition to a regression unit test, I also validated that the code snippet below does not work on v5.0 but works after this patch:

from sec_edgar_downloader import Downloader

downloader = Downloader("Jad Chaar", "jad.chaar@gmail.com")

downloaded = downloader.get("424B2", "0000312070", limit=1)
print(downloaded)

Closes: https://github.com/jadchaar/sec-edgar-downloader/issues/126

codecov[bot] commented 1 year ago

Codecov Report

All modified lines are covered by tests :white_check_mark:

Comparison is base (c162336) 100.00% compared to head (6779d2d) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #128 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 8 8 Lines 218 218 Branches 30 30 ========================================= Hits 218 218 ``` | [Files](https://app.codecov.io/gh/jadchaar/sec-edgar-downloader/pull/128?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jad+Chaar) | Coverage Δ | | |---|---|---| | [sec\_edgar\_downloader/\_orchestrator.py](https://app.codecov.io/gh/jadchaar/sec-edgar-downloader/pull/128?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jad+Chaar#diff-c2VjX2VkZ2FyX2Rvd25sb2FkZXIvX29yY2hlc3RyYXRvci5weQ==) | `100.00% <100.00%> (ø)` | | | [sec\_edgar\_downloader/\_version.py](https://app.codecov.io/gh/jadchaar/sec-edgar-downloader/pull/128?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jad+Chaar#diff-c2VjX2VkZ2FyX2Rvd25sb2FkZXIvX3ZlcnNpb24ucHk=) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.