Add changing cars

This commit is contained in:
SemvdH
2025-11-18 00:01:39 +01:00
parent 12f1adccf2
commit 51cd76b311
3 changed files with 15 additions and 12 deletions

View File

@@ -166,15 +166,17 @@ class Handler(BaseHTTPRequestHandler):
import json
try:
data = json.loads(body)
print("Received cars:", data)
success, message = update_cars(data.get("cars", []))
return True
except json.JSONDecodeError:
self.send_response(400)
self.send_header("Content-Type", "application/json")
self.end_headers()
self.wfile.write(b'{"error":"invalid json"}')
return
print("Invalid JSON received")
return False
print("Received cars:", data)
def send_image(self, img_path: str):
if os.path.exists(img_path):