Spaces:
Sleeping
Sleeping
Create foia_requests.py
Browse files- foia_requests.py +22 -50
foia_requests.py
CHANGED
|
@@ -1,52 +1,24 @@
|
|
| 1 |
-
from typing import Dict, List
|
| 2 |
-
import json
|
| 3 |
-
import os
|
| 4 |
-
import uuid
|
| 5 |
from datetime import datetime
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
description: str,
|
| 30 |
-
requester_type: str = "Journalist"
|
| 31 |
-
) -> Dict:
|
| 32 |
-
"""
|
| 33 |
-
Store a FOIA request record (tracking only).
|
| 34 |
-
No submission to agencies is performed.
|
| 35 |
-
"""
|
| 36 |
-
|
| 37 |
-
record = {
|
| 38 |
-
"id": str(uuid.uuid4()),
|
| 39 |
-
"timestamp": datetime.utcnow().isoformat() + "Z",
|
| 40 |
-
"agency": agency,
|
| 41 |
-
"subject": subject,
|
| 42 |
-
"description": description,
|
| 43 |
-
"requester_type": requester_type,
|
| 44 |
-
"status": "Draft",
|
| 45 |
-
"notes": "Generated by FOIA Declassified Document Search (tracking only)"
|
| 46 |
-
}
|
| 47 |
-
|
| 48 |
-
requests = _load_requests()
|
| 49 |
-
requests.append(record)
|
| 50 |
-
_save_requests(requests)
|
| 51 |
-
|
| 52 |
-
return record
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from datetime import datetime
|
| 2 |
|
| 3 |
+
def generate_foia_request_text(agency, subject, requester):
|
| 4 |
+
return f"""
|
| 5 |
+
Freedom of Information Act Request
|
| 6 |
+
|
| 7 |
+
Date: {datetime.utcnow().strftime('%B %d, %Y')}
|
| 8 |
+
|
| 9 |
+
To: {agency} FOIA Office
|
| 10 |
+
|
| 11 |
+
Pursuant to the Freedom of Information Act, I request access to records
|
| 12 |
+
concerning the following subject:
|
| 13 |
+
|
| 14 |
+
{subject}
|
| 15 |
+
|
| 16 |
+
I request a waiver of fees as this request is made in the public interest.
|
| 17 |
+
Please provide records electronically where possible.
|
| 18 |
+
|
| 19 |
+
Requester:
|
| 20 |
+
{requester}
|
| 21 |
+
|
| 22 |
+
Sincerely,
|
| 23 |
+
{requester}
|
| 24 |
+
""".strip()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|