mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-04 04:14:58 +00:00
changed db connection
This commit is contained in:
@@ -108,15 +108,6 @@ def move():
|
||||
db_connection.close()
|
||||
return jsonify({"status": "success", "direction": direction})
|
||||
|
||||
@app.route("/database")
|
||||
def database():
|
||||
db = get_db()
|
||||
cursor = db.cursor()
|
||||
cursor.execute("SELECT * FROM kobuki_data")
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
return str(rows)
|
||||
|
||||
|
||||
@app.route('/data', methods=['GET'])
|
||||
def data():
|
||||
@@ -139,7 +130,7 @@ def data():
|
||||
|
||||
# Database-insert
|
||||
db = get_db()
|
||||
cursor = db.cursor()
|
||||
with db.cursor() as cursor:
|
||||
|
||||
# Zorg dat je tabel `kobuki_data` kolommen heeft: `name` en `value`
|
||||
sql_sensor = "INSERT INTO kobuki_data (name, value) VALUES (%s, %s)"
|
||||
|
Reference in New Issue
Block a user