From 77c8039af68cf99daf58e5bfbce01bc55095e536 Mon Sep 17 00:00:00 2001 From: heboba Date: Thu, 19 Feb 2026 22:22:27 +0100 Subject: [PATCH] chore: sync local changes --- app.py | 5 ++++- package.json | 2 +- src/py/script/db_connect.py | 2 +- src/py/script/json/plants.json | 18 ------------------ 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/app.py b/app.py index 223a811..1a8b5ad 100644 --- a/app.py +++ b/app.py @@ -10,7 +10,7 @@ def database_connect(): connection = mysql.connector.connect( host="localhost", user="root", - password="", + password="root", database="goodgarden" ) return connection @@ -18,10 +18,12 @@ def database_connect(): except Exception as e: print("Database connection failed:", e) + #Throw error return None # Function to get data from the MySQL database def get_database_data(): + #Throw error mydb = database_connect() if mydb and mydb.is_connected(): @@ -45,6 +47,7 @@ def get_data(): return jsonify(battery_data) # Directly return the list of dictionaries as JSON def get_weather_data(): + # Api key in a file api_key = "05ddd06644" location = "Leiden" url = f"https://weerlive.nl/api/weerlive_api_v2.php?key={api_key}&locatie={location}" diff --git a/package.json b/package.json index fa0d65a..0de4bc6 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "start": "npm-run-all --parallel start-flask start-electron", "start-electron": "wait-on http://localhost:5000 && electron app.js", - "start-flask": "python app.py" + "start-flask": "py app.py" }, "author": "", "license": "ISC", diff --git a/src/py/script/db_connect.py b/src/py/script/db_connect.py index 68054b9..09ca1db 100644 --- a/src/py/script/db_connect.py +++ b/src/py/script/db_connect.py @@ -10,7 +10,7 @@ def database_connect(): connection = mysql.connector.connect( host="localhost", # De hostnaam waar de database draait, in dit geval lokaal. user="root", # De gebruikersnaam voor de database. - password="", # Het wachtwoord voor de gebruiker, leeg in dit geval. + password="root", # Het wachtwoord voor de gebruiker, leeg in dit geval. database="goodgarden" # De naam van de database waarmee je wilt verbinden. ) # Controleer of de verbinding succesvol is opgezet. diff --git a/src/py/script/json/plants.json b/src/py/script/json/plants.json index c3a2aa2..2513f49 100644 --- a/src/py/script/json/plants.json +++ b/src/py/script/json/plants.json @@ -4,23 +4,5 @@ "plant_naam": "Tomatenplant", "plantensoort": "Groente", "plant_geteelt": 1 - }, - { - "id": 15, - "plant_naam": "ergerg", - "plantensoort": "ergerwgergerg", - "plant_geteelt": 1 - }, - { - "id": 16, - "plant_naam": "sdfsf", - "plantensoort": "ewfewfwf", - "plant_geteelt": 1 - }, - { - "id": 17, - "plant_naam": "34t3t34t34t", - "plantensoort": "343245345345", - "plant_geteelt": 1 } ] \ No newline at end of file