jayyd commited on
Commit
b7fc7b6
·
verified ·
1 Parent(s): d5b8f78

Update utils/download_reports.py

Browse files
Files changed (1) hide show
  1. utils/download_reports.py +22 -0
utils/download_reports.py CHANGED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import os
3
+
4
+ def download_pdf(url, dest_path):
5
+ resp = requests.get(url)
6
+ resp.raise_for_status()
7
+ with open(dest_path, "wb") as f:
8
+ f.write(resp.content)
9
+ print(f"Saved to {dest_path}")
10
+
11
+ if __name__ == "__main__":
12
+ os.makedirs("data/raw", exist_ok=True)
13
+ reports = {
14
+ "2023": "https://www.annualreports.com/HostedData/AnnualReports/PDF/NYSE_ALL_2023.pdf",
15
+ "2022": "https://www.annualreports.com/HostedData/AnnualReportArchive/a/NYSE_ALL_2022.pdf",
16
+ }
17
+
18
+ for year, url in reports.items():
19
+ try:
20
+ download_pdf(url, f"data/raw/Allstate_{year}_10K.pdf")
21
+ except Exception as e:
22
+ print(f"Failed to download {year} report: {e}")