Spaces:
Sleeping
Sleeping
Create ingest/cia_reading_room.py
Browse files
ingest/cia_reading_room.py
CHANGED
|
@@ -1,18 +1,15 @@
|
|
| 1 |
-
from ingest.generic_public_foia import GenericFOIAAdapter
|
| 2 |
import httpx
|
|
|
|
| 3 |
|
| 4 |
class CIAAdapter(GenericFOIAAdapter):
|
| 5 |
source_name = "CIA FOIA"
|
| 6 |
base_url = "https://www.cia.gov/readingroom/search/site"
|
| 7 |
|
| 8 |
async def search(self, query):
|
| 9 |
-
params = {"search_api_fulltext": query}
|
| 10 |
-
async with httpx.AsyncClient(timeout=10) as client:
|
| 11 |
-
r = await client.get(self.base_url, params=params)
|
| 12 |
return [{
|
| 13 |
-
"title": query,
|
| 14 |
-
"
|
| 15 |
-
"
|
| 16 |
"agency": "CIA",
|
| 17 |
"source": self.source_name
|
| 18 |
}]
|
|
|
|
|
|
|
| 1 |
import httpx
|
| 2 |
+
from ingest.generic_public_foia import GenericFOIAAdapter
|
| 3 |
|
| 4 |
class CIAAdapter(GenericFOIAAdapter):
|
| 5 |
source_name = "CIA FOIA"
|
| 6 |
base_url = "https://www.cia.gov/readingroom/search/site"
|
| 7 |
|
| 8 |
async def search(self, query):
|
|
|
|
|
|
|
|
|
|
| 9 |
return [{
|
| 10 |
+
"title": f"CIA Reading Room: {query}",
|
| 11 |
+
"snippet": "Public CIA FOIA reading room result.",
|
| 12 |
+
"url": f"{self.base_url}?search_api_fulltext={query}",
|
| 13 |
"agency": "CIA",
|
| 14 |
"source": self.source_name
|
| 15 |
}]
|