Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download straight to variable / memory #132

Open
Elijas opened this issue Oct 12, 2023 · 1 comment
Open

Download straight to variable / memory #132

Elijas opened this issue Oct 12, 2023 · 1 comment

Comments

@Elijas
Copy link

Elijas commented Oct 12, 2023

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@example.com")
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@example.com", 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...
@jadchaar
Copy link
Owner

Hi @Elijas, currently this tool only downloads and stores filings onto disk, but I will note this down for a future improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants