From f288e88da83cd3fde6a35c97976e223d329214c5 Mon Sep 17 00:00:00 2001 From: Maximilian Gruber <maximilian.gruber@ptb.de> Date: Mon, 15 Apr 2024 10:13:30 +0200 Subject: [PATCH] provide new api option to download image --- app/main.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/main.py b/app/main.py index c534655..c268b10 100644 --- a/app/main.py +++ b/app/main.py @@ -173,6 +173,18 @@ def download_certificate(hash: str, db: Session = Depends(get_db)): return {"message": "Result not ready."} +@app.post("/result/image") +def download_image(hash: str, db: Session = Depends(get_db)): + # ready, not ready, ongoing + session = crud.get_cocal_session_by_hash(db, hash) + + if session.result_state == "ready": + filepath = Path(".").joinpath("sessions", session.hash, "transfer_behaviour.png") + return FileResponse(filepath, filename=filepath.name) + else: + return {"message": "Result not ready."} + + ######################################################################################## ######### offline Swagger UI ########################################################### ######################################################################################## -- GitLab