From a1704a27055df09c41700f60d5293ec68c0c1d4c Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Sat, 12 Feb 2022 16:44:15 +0100 Subject: when generating JSON documents, put generating software info in 'generated_by' property --- src/hydrilla/server/serve.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/hydrilla/server') 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) -- cgit v1.2.3