From 704bf2989212c8b9071ed5ffe942c325a47fd704 Mon Sep 17 00:00:00 2001 From: Bla Date: Sat, 21 Oct 2023 18:03:16 +0000 Subject: [PATCH] value format now .1f --- server-web.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server-web.py b/server-web.py index 12ff799..c410896 100644 --- a/server-web.py +++ b/server-web.py @@ -51,7 +51,7 @@ def handleJson(jsonObj): if isinstance(jsonObj, list): if 'online-level' in jsonObj: #typ = jsonObj[1]["LevelValues"][0]["Type"] - value = jsonObj[1]["LevelValues"][0]["Values"] + value = jsonObj[1]["LevelValues"][0]["Values"][0] NmtId = jsonObj[1]["NmtId"] time = jsonObj[1]["Time"] valuestore[NmtId] = value @@ -61,9 +61,9 @@ def handleJson(jsonObj): @app.route('/nmt/') def nmtid(id): if id in valuestore and datetime.now(timezone.utc) - parser.parse(datestore[id]) < timedelta(seconds=30): - return valuestore[id] + return format( valuestore[id], '.1f') else: - return "Not Found" + return "E_NA" # Entweder out of date oder nicht existent # Gibt eine Liste mit verfuegbaren ids zurueck @app.route('/ids')