Skip to content

Commit d5d9bd1

Browse files
committed
fix: Handle None response in get_edgar_taxonomies and update content type checks in EdgarSession
1 parent a3b197b commit d5d9bd1

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

edgar/datasets.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ def get_edgar_taxonomies(self) -> list[dict]:
8585
endpoint='/info/edgar/edgartaxonomies.xml'
8686
)
8787

88+
if response is None:
89+
return []
90+
8891
response = self.edgar_parser.parse_loc_elements(
8992
response_text=response
9093
)

edgar/session.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,12 @@ def make_request(
254254
return response.json()
255255
elif any(
256256
ct in content_type
257-
for ct in ["application/atom+xml", "text/xml", "text/html"]
257+
for ct in [
258+
"application/atom+xml",
259+
"application/xml",
260+
"text/xml",
261+
"text/html",
262+
]
258263
):
259264
return response.text
260265

tests/test_to_dataframe.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
from unittest.mock import patch
66

7-
import pandas as pd
87
import pytest
98

9+
pd = pytest.importorskip("pandas", reason="pandas required for DataFrame tests")
10+
1011
from edgar.models import (
1112
Fact,
1213
Facts,

0 commit comments

Comments
 (0)