Skip to content

Commit

Permalink
Fix bug with trailing 0 in CIK (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
jadchaar authored Sep 30, 2023
1 parent c162336 commit 3e8bad5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sec_edgar_downloader/_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def aggregate_filings_to_download(


def get_to_download(cik: str, acc_num: str, doc: str) -> ToDownload:
cik = cik.strip("0")
cik = cik.lstrip("0")
acc_num_no_dash = acc_num.replace("-", "")
raw_filing_uri = URL_FILING.format(
cik=cik, acc_num_no_dash=acc_num_no_dash, document=f"{acc_num}.txt"
Expand Down
2 changes: 1 addition & 1 deletion sec_edgar_downloader/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "5.0.0"
__version__ = "5.0.1"
16 changes: 16 additions & 0 deletions tests/test_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,22 @@ def test_get_to_download_given_html(apple_cik, accession_number, form_8k_primary
assert result.details_doc_suffix == ".html"


# Regression test for https://github.com/jadchaar/sec-edgar-downloader/issues/126
def test_get_to_download_given_cik_with_trailing_zero():
result = get_to_download(
"0000312070", "0000950103-23-014290", "dp200734_424b2-5333pps.htm"
)

assert result.raw_filing_uri == (
"https://www.sec.gov/Archives/edgar/data/312070/000095010323014290/0000950103-23-014290.txt"
)
assert result.primary_doc_uri == (
"https://www.sec.gov/Archives/edgar/data/312070/000095010323014290/dp200734_424b2-5333pps.htm"
)
assert result.accession_number == "0000950103-23-014290"
assert result.details_doc_suffix == ".html"


def test_fetch_and_save_filings_given_download_details(user_agent, form_10k, apple_cik):
limit = 2
download_metadata = DownloadMetadata(
Expand Down

0 comments on commit 3e8bad5

Please sign in to comment.