From a00f9593cebbda4d75ca05b0c281fcfc87bf05d5 Mon Sep 17 00:00:00 2001 From: Andreas Date: Wed, 11 Dec 2024 09:56:07 +0100 Subject: [PATCH] Gesamtlast does not work anymore. Wrong FastAPI Header. Swagger also wrong --- src/akkudoktoreos/server/fastapi_server.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/akkudoktoreos/server/fastapi_server.py b/src/akkudoktoreos/server/fastapi_server.py index 84a2aff..5fd12be 100755 --- a/src/akkudoktoreos/server/fastapi_server.py +++ b/src/akkudoktoreos/server/fastapi_server.py @@ -13,7 +13,7 @@ from fastapi.exceptions import HTTPException matplotlib.use("Agg") import pandas as pd -from fastapi import FastAPI, Query +from fastapi import FastAPI, Query, Body from fastapi.responses import FileResponse, RedirectResponse from akkudoktoreos.config import ( @@ -72,9 +72,9 @@ def fastapi_strompreis() -> list[float]: @app.post("/gesamtlast") def fastapi_gesamtlast( - year_energy: float, - measured_data: list[dict[str, Any]], - hours: int = config.eos.prediction_hours, + year_energy: float = Body(..., embed=True), + measured_data: list[dict[str, Any]] = Body(...), + hours: int = Body(..., embed=True), ) -> list[float]: """Endpoint to handle total load calculation based on the latest measured data.""" # Measured data in JSON format