aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-02-12 16:44:15 +0100
committerWojtek Kosior <koszko@koszko.org>2022-02-12 16:44:15 +0100
commita1704a27055df09c41700f60d5293ec68c0c1d4c (patch)
tree710e59436d21fc9eeea29928e41bf483dd93d319 /src/hydrilla
parent40c24168fcaf9251f56e8570538e9a7dd48795e9 (diff)
downloadhaketilo-hydrilla-a1704a27055df09c41700f60d5293ec68c0c1d4c.tar.gz
haketilo-hydrilla-a1704a27055df09c41700f60d5293ec68c0c1d4c.zip
when generating JSON documents, put generating software info in 'generated_by' property
Diffstat (limited to 'src/hydrilla')
-rw-r--r--src/hydrilla/server/serve.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/hydrilla/server/serve.py b/src/hydrilla/server/serve.py
index 6cfceaa..8a2b3a5 100644
--- a/src/hydrilla/server/serve.py
+++ b/src/hydrilla/server/serve.py
@@ -42,9 +42,15 @@ from werkzeug import Response
from .. import util
from . import config
+from . import _version
here = Path(__file__).resolve().parent
+generated_by = {
+ 'name': 'hydrilla.server',
+ 'version': _version.version
+}
+
class ItemInfo(ABC):
"""Shortened data of a resource/mapping."""
def __init__(self, item_obj: dict):
@@ -532,10 +538,8 @@ def query():
mapping_refs = [i.as_query_result() for i in malcontent().query(url)]
result = {
'api_schema_version': [1],
- 'generated_by': {
- 'name': 'hydrilla'
- },
- 'mappings': mapping_refs
+ 'mappings': mapping_refs,
+ 'generated_by': generated_by
}
return json.dumps(result)