Feature/wikipedia ddg (#185)

API-side support for Wikipedia, DBpedia and internet search functions  This incorporates a refactor of the API code to break it up, separate classes for endpoints to reduce duplication
This commit is contained in:
cybermaggedon 2024-12-02 17:41:30 +00:00 committed by GitHub
parent 212102c61c
commit 6d200c79c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
50 changed files with 1287 additions and 826 deletions

30
test-api/test-dbpedia Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env python3
import requests
import json
import sys
url = "http://localhost:8088/api/v1/"
############################################################################
input = {
"term": "Cornwall",
}
resp = requests.post(
f"{url}dbpedia",
json=input,
)
resp = resp.json()
if "error" in resp:
print(f"Error: {resp['error']}")
sys.exit(1)
print(resp["text"])
sys.exit(0)
############################################################################