Skip to content
Snippets Groups Projects
Commit f288e88d authored by Maximilian Gruber's avatar Maximilian Gruber
Browse files

provide new api option to download image

parent 07f3561c
No related branches found
No related tags found
No related merge requests found
...@@ -173,6 +173,18 @@ def download_certificate(hash: str, db: Session = Depends(get_db)): ...@@ -173,6 +173,18 @@ def download_certificate(hash: str, db: Session = Depends(get_db)):
return {"message": "Result not ready."} 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 ########################################################### ######### offline Swagger UI ###########################################################
######################################################################################## ########################################################################################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment