Skip to content

Download straight to variable / memory #132

@Elijas

Description

@Elijas

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions