dgunning / edgartools

Python library for working with SEC Edgar
MIT License
324 stars 70 forks source link

How to download the attachments? #61

Closed Karie0910 closed 3 weeks ago

Karie0910 commented 3 weeks ago

I am trying to download the attachments. filings = get_filings(range(2022, 2025), form="NPORT-P", amendments=True) filings[0].attachments.download(path=r'D:/Karie') Then there are some errors: image How to solve this? Thank you!

dgunning commented 3 weeks ago

Hello Karie,

Can you select the specific filing you are trying to download e.g.

str(filings[0])
"Filing(form='NPORT-P', filing_date='2024-06-11', company='AETOS DISTRESSED INVESTMENT STRATEGIES FUND LLC', cik=1169578, accession_no='0001104659-24-070456')"

Although since a day has passed filings[0] will likely have changed. In any even see if you can get a single identified filing to fail

Karie0910 commented 3 weeks ago

It goes like str(f) "Filing(form='NPORT-P', filing_date='2023-02-28', company='AB BOND FUND, INC.', cik=3794, accession_no='0001752724-23-047092')" By the way, is there a way to mass download all the filings? Thanks!

dgunning commented 3 weeks ago

The original issue with the error downloading the attachments could possibly be an encoding bug.

I'm making a change to set the encoding explicitly as 'utf-8' and will release a new version in a day or two

dgunning commented 3 weeks ago

Released version 2.24.2 which explicitly sets the encoding to 'utf-8'. Please test

Karie0910 commented 3 weeks ago

Thank you! It is working now.