Skip to content

Commit 1b33eac

Browse files
added new filing download API
1 parent a72d1b2 commit 1b33eac

File tree

4 files changed

+27
-12
lines changed

4 files changed

+27
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ It includes:
1212

1313
# Data Coverage
1414

15-
- All +18 million SEC EDGAR filings dating back to 1993
15+
- All +18 million SEC EDGAR filings dating back to 1993 - 650,000 gigabyte of filings data.
1616
- **All +150 filing types** are supported, eg 10-Q, 10-K, 4, 8-K, 13-F, S-1, 424B4 and many more.
1717
[See the list of supported form types here.](https://sec-api.io/list-of-sec-filing-types)
1818
- Newly published filings are accessible in real-time

examples.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1-
from sec_api.index import XbrlApi, ExtractorApi
1+
from sec_api.index import RenderApi, XbrlApi, ExtractorApi
22

33
#
4-
# XBRL-to-JSON API example
4+
# Render API
55
#
6+
"""
7+
renderApi = RenderApi("YOUR_API_KEY")
8+
9+
# 10-K HTM File URL example
10+
filing_data = renderApi.get_filing(
11+
url="https://www.sec.gov/Archives/edgar/data/320193/000032019320000096/aapl-20200926.htm"
12+
)
13+
14+
print(filing_data)
15+
"""
616

7-
# """
17+
#
18+
# XBRL-to-JSON API example
19+
#
20+
"""
821
xbrlApi = XbrlApi("YOUR_API_KEY")
922
1023
@@ -24,13 +37,13 @@
2437
2538
# 10-K XBRL File URL example
2639
xbrl_json_3 = xbrlApi.xbrl_to_json(accession_no="0001564590-21-004599")
27-
# """
40+
41+
"""
2842

2943
#
3044
# Extractor API Example
3145
#
32-
33-
# """
46+
"""
3447
extractorApi = ExtractorApi("YOUR_API_KEY")
3548
3649
# Tesla 10-K filing
@@ -41,4 +54,4 @@
4154
4255
print(section_text)
4356
print(section_html)
44-
# """
57+
"""

sec_api/index.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import requests
22
import json
3+
import re
34

45
query_api_endpoint = "https://api.sec-api.io"
56
full_text_search_api_endpoint = "https://api.sec-api.io/full-text-search"
6-
render_api_endpoint = "https://api.sec-api.io/filing-reader"
7+
render_api_endpoint = "https://archive.sec-api.io"
78
xbrl_api_endpoint = "https://api.sec-api.io/xbrl-to-json"
89
extractor_api_endpoint = "https://api.sec-api.io/extractor"
910

@@ -43,10 +44,11 @@ class RenderApi:
4344

4445
def __init__(self, api_key):
4546
self.api_key = api_key
46-
self.api_endpoint = render_api_endpoint + "?token=" + api_key
47+
self.api_endpoint = render_api_endpoint
4748

4849
def get_filing(self, url):
49-
_url = self.api_endpoint + "&type=html&url=" + url
50+
filename = re.sub(r"https://www.sec.gov/Archives/edgar/data", "", url)
51+
_url = self.api_endpoint + filename + "?token=" + self.api_key
5052
response = requests.get(_url)
5153
return response.text
5254

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

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

0 commit comments

Comments
 (0)