Spaces:
Sleeping
Sleeping
Create ingest/adapters/stub.py
Browse files- ingest/adapters/stub.py +21 -0
ingest/adapters/stub.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from ingest.generic_public_foia import GenericFOIAAdapter
|
| 2 |
+
|
| 3 |
+
class StubAdapter(GenericFOIAAdapter):
|
| 4 |
+
live = False
|
| 5 |
+
|
| 6 |
+
def __init__(self, source_name: str, reason: str):
|
| 7 |
+
super().__init__()
|
| 8 |
+
self.source_name = source_name
|
| 9 |
+
self.reason = reason
|
| 10 |
+
self.base_url = ""
|
| 11 |
+
|
| 12 |
+
async def search(self, query: str):
|
| 13 |
+
return [{
|
| 14 |
+
"source": f"{self.source_name} (STUB)",
|
| 15 |
+
"title": f"{self.source_name} – Stub Only",
|
| 16 |
+
"url": "",
|
| 17 |
+
"snippet": (
|
| 18 |
+
"This agency does not permit automated querying or does not "
|
| 19 |
+
f"provide a public FOIA search endpoint. Reason: {self.reason}."
|
| 20 |
+
)
|
| 21 |
+
}]
|