From 455a58ba0291911b0ae67ede95105738a57780e3 Mon Sep 17 00:00:00 2001 From: Dwight Gunning Date: Tue, 27 Aug 2024 07:12:37 -0400 Subject: [PATCH] Fix None entity in filing header --- edgar/filingheader.py | 2 +- tests/test_filing_header.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/edgar/filingheader.py b/edgar/filingheader.py index 869aad3f..c52ec53c 100644 --- a/edgar/filingheader.py +++ b/edgar/filingheader.py @@ -495,7 +495,7 @@ def parse_from_sgml_text(cls, header_text: str, preprocess=False): if cik: from edgar.entities import Entity, EntityData entity: EntityData = Entity(cik, include_old_filings=False) - if not entity.is_company: + if entity and not entity.is_company: name = reverse_name(name) owner = Owner(name=name, cik=cik) diff --git a/tests/test_filing_header.py b/tests/test_filing_header.py index d9ee5f36..d030fe01 100644 --- a/tests/test_filing_header.py +++ b/tests/test_filing_header.py @@ -376,3 +376,10 @@ def test_get_header_from_old_filing(): accession_no='0001012325-98-000004') header = filing.header assert header.accession_number == '0001012325-98-000004' + + +def test_get_header_for_filing_with_no_reportingowner_entity(): + filing = Filing(form='4', filing_date='2024-08-23', company='Hut 8 Corp.', cik=1964789, + accession_no='0001127602-24-022866') + header = filing.header + assert header