From b48243f83190afc2148904d799c01f9ae2d3cb62 Mon Sep 17 00:00:00 2001 From: "ishak jmilou.ishak" Date: Mon, 13 Jan 2025 14:57:52 +0100 Subject: [PATCH] changed sensor data to db in other function --- src/Python/flask/web/app.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Python/flask/web/app.py b/src/Python/flask/web/app.py index 4a11291..84b2fd7 100644 --- a/src/Python/flask/web/app.py +++ b/src/Python/flask/web/app.py @@ -119,8 +119,10 @@ def database(): rows = cursor.fetchall() cursor.close() return str(rows) + -def sensor_data(kobuki_message): +@app.route('/data', methods=['GET']) +def data(): try: # Parse de JSON-string naar een Python-dictionary data = json.loads(kobuki_message) @@ -153,10 +155,8 @@ def sensor_data(kobuki_message): print(f"JSON decode error: {e}") except mysql.connector.Error as err: print(f"Database error: {err}") - -@app.route('/data', methods=['GET']) -def data(): return kobuki_message + @app.route('/image')