sec-edgar-downloader
sec-edgar-downloader copied to clipboard
Download straight to variable / memory
Hello 👋,
I'm using sec-edgar-downloader and would like to know if it's possible to directly download filings (e.g., 10-Q for AAPL) in HTML format without file access?
The workaround I'm using currently is:
from sec_downloader import Downloader
dl = Downloader("MyCompanyName", "[email protected]")
html = dl.get_latest_html("10-Q", "AAPL")
print(f"{html[:50]}...")
<?xml version="1.0" ?><!--XBRL Document Created wi...
which is implemented as
# pip install sec-edgar-downloader sec-downloader
from sec_edgar_downloader import Downloader
from sec_downloader import DownloadStorage
ONLY_HTML = "**/*.htm*"
storage = DownloadStorage(filter_pattern=ONLY_HTML)
with storage as path:
dl = Downloader("MyCompanyName", "[email protected]", path)
dl.get("10-Q", "AAPL", limit=1, download_details=True)
# all files are now deleted and only stored in memory
content = storage.get_file_contents()[0].content
print(f"{content[:50]}...")
<?xml version="1.0" ?><!--XBRL Document Created wi...
Hi @Elijas, currently this tool only downloads and stores filings onto disk, but I will note this down for a future improvement.