FOIA_Doc_Search / dod_reading_room_live.py
GodsDevProject's picture
Upload 98 files
bb0b469 verified
raw
history blame
707 Bytes
import httpx
from ingest.generic_public_foia import GenericFOIAAdapter
class DoDAdapter(GenericFOIAAdapter):
name = "DoD FOIA Reading Room"
rate_limit = 1
robots_respected = True
base_url = "https://www.esd.whs.mil/FOIA/Reading-Room/"
async def search(self, query: str):
async with httpx.AsyncClient(timeout=10) as client:
r = await client.get(self.base_url, params={"search": query})
if r.status_code != 200:
return []
return [{
"source": "DoD FOIA Reading Room",
"query": query,
"url": str(r.url),
"snippet": "Public DoD FOIA reading room page"
}]