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)