Skip to content

Commit 61cb1e0

Browse files
fixed bug: inline XBRL filings with "ix?doc=/" in URL cause "Max retries exceeded" error in RenderApi
1 parent 9f02c26 commit 61cb1e0

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

examples.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
2727
# 10-K HTM File URL example
2828
filing_data = renderApi.get_filing(
29-
url="https://www.sec.gov/Archives/edgar/data/320193/000032019320000096/aapl-20200926.htm"
29+
# url="https://www.sec.gov/Archives/edgar/data/320193/000032019320000096/aapl-20200926.htm"
30+
url="https://www.sec.gov/ix?doc=/Archives/edgar/data/1320695/000132069520000148/ths12-31x201910krecast.htm"
3031
)
3132
3233
print(filing_data)
@@ -340,8 +341,8 @@
340341
item_4_02_api = Item_4_02_Api("YOUR_API_KEY")
341342
342343
query = {
343-
"query": "ticker:AEON",
344-
"from": "0",
344+
"query": "filedAt:[2010-01-01 TO 2019-12-31]",
345+
"from": "0", # increase by 50 to fetch the next 50 results, e.g. 50 (=page 2), 100 (=page 3), 150 (=page 4), ...
345346
"size": "50",
346347
"sort": [{"filedAt": {"order": "desc"}}],
347348
}

sec_api/index.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ def __init__(self, api_key, proxies=None):
107107

108108
def get_filing(self, url, as_pdf=False):
109109
response = {}
110-
filename = re.sub(r"https://www.sec.gov/Archives/edgar/data", "", url)
110+
# remove "ix?doc=/" from URL
111+
filename = re.sub(r"ix\?doc=/", "", url)
112+
filename = re.sub(r"https://www.sec.gov/Archives/edgar/data", "", filename)
111113
_url = self.api_endpoint + filename + "?token=" + self.api_key
112114

113115
# use backoff strategy to handle "too many requests" error.

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="sec-api",
8-
version="1.0.21",
8+
version="1.0.22",
99
author="SEC API",
1010
author_email="[email protected]",
1111
description="SEC EDGAR Filings API",

0 commit comments

Comments
 (0)