Spaces:
Sleeping
Sleeping
| 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" | |
| }] |