Spaces:
Sleeping
Sleeping
Create ingest/foia_request.py
Browse files- ingest/foia_request.py +21 -0
ingest/foia_request.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from reportlab.platypus import SimpleDocTemplate, Paragraph
|
| 2 |
+
from reportlab.lib.styles import getSampleStyleSheet
|
| 3 |
+
import tempfile
|
| 4 |
+
|
| 5 |
+
def generate_foia_packet(agency, subject):
|
| 6 |
+
styles = getSampleStyleSheet()
|
| 7 |
+
tmp = tempfile.NamedTemporaryFile(delete=False, suffix=".pdf")
|
| 8 |
+
|
| 9 |
+
doc = SimpleDocTemplate(tmp.name)
|
| 10 |
+
content = [
|
| 11 |
+
Paragraph("Freedom of Information Act Request", styles["Title"]),
|
| 12 |
+
Paragraph(f"Agency: {agency}", styles["Normal"]),
|
| 13 |
+
Paragraph(f"Subject: {subject}", styles["Normal"]),
|
| 14 |
+
Paragraph(
|
| 15 |
+
"This request is made under 5 U.S.C. § 552 for records "
|
| 16 |
+
"maintained in public electronic reading rooms.",
|
| 17 |
+
styles["Normal"]
|
| 18 |
+
)
|
| 19 |
+
]
|
| 20 |
+
doc.build(content)
|
| 21 |
+
return tmp.name
|