From ec71028270ab220ffb3288f225fbd236e44eb71c Mon Sep 17 00:00:00 2001 From: "ishak jmilou.ishak" Date: Thu, 9 Jan 2025 14:16:16 +0100 Subject: [PATCH] wrote own functions for sending data --- src/Python/flask/web/app.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Python/flask/web/app.py b/src/Python/flask/web/app.py index 3ebc7bd..a94d875 100644 --- a/src/Python/flask/web/app.py +++ b/src/Python/flask/web/app.py @@ -91,14 +91,13 @@ def database(): cursor.close() return str(rows) -def sensor_data(): +def sensor_data(kobuki_message): db = get_db() cursor = db.cursor() - cursor.execute("SELECT * FROM kobuki_data") - rows = cursor.fetchall() + sql_sensor = "INSERT INTO kobuki_data (data) VALUES (%s)" + cursor.execute(sql_sensor, (kobuki_message,)) + db.commit() cursor.close() - return str(rows) - if __name__ == '__main__': app.run(debug=True, port=5000)