diff --git a/sec_edgar_downloader/_Downloader.py b/sec_edgar_downloader/_Downloader.py index d88e2e5..5828851 100644 --- a/sec_edgar_downloader/_Downloader.py +++ b/sec_edgar_downloader/_Downloader.py @@ -67,6 +67,7 @@ def get( before: Optional[Date] = None, include_amends: bool = False, download_details: bool = False, + skip_accession_numbers: Optional[set[str]] = None, ) -> int: """Download filings and save them to disk. @@ -84,6 +85,7 @@ def get( Defaults to False. :param download_details: denotes whether to download human-readable and easily parseable filing detail documents (e.g. form 4 XML, 8-K HTML). Defaults to False. + :param skip_accession_numbers: Set of accession numbers to skip when downloading. :return: number of filings downloaded. Usage:: @@ -173,6 +175,7 @@ def get( download_details, # Save ticker if passed in to form file system path for saving filings ticker=ticker_or_cik if not is_cik(ticker_or_cik) else None, + skip_accession_numbers=skip_accession_numbers, ), self.user_agent, ) diff --git a/sec_edgar_downloader/_orchestrator.py b/sec_edgar_downloader/_orchestrator.py index 223f827..b5d5809 100644 --- a/sec_edgar_downloader/_orchestrator.py +++ b/sec_edgar_downloader/_orchestrator.py @@ -130,6 +130,9 @@ def get_to_download(cik: str, acc_num: str, doc: str) -> ToDownload: def fetch_and_save_filings(download_metadata: DownloadMetadata, user_agent: str) -> int: successfully_downloaded = 0 to_download = aggregate_filings_to_download(download_metadata, user_agent) + if download_metadata.skip_accession_numbers is not None: + to_download = [td for td in to_download if td.accession_number not in download_metadata.skip_accession_numbers] + for td in to_download: try: save_location = get_save_location( diff --git a/sec_edgar_downloader/_types.py b/sec_edgar_downloader/_types.py index 5dd6c4f..1f900b2 100644 --- a/sec_edgar_downloader/_types.py +++ b/sec_edgar_downloader/_types.py @@ -20,6 +20,7 @@ class DownloadMetadata: include_amends: bool = False download_details: bool = False ticker: Optional[str] = None + skip_accession_numbers: Optional[set[str]] = None @dataclass