From 1431101fcd0e73463234473faeb41e48e21895f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Sun, 9 Oct 2022 00:40:20 +0000 Subject: [PATCH] mehr spacken --- api/advent22_api/routers/abspacken.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/api/advent22_api/routers/abspacken.py b/api/advent22_api/routers/abspacken.py index d8211fe..dbbf023 100644 --- a/api/advent22_api/routers/abspacken.py +++ b/api/advent22_api/routers/abspacken.py @@ -1,11 +1,12 @@ import asyncio -from fastapi import APIRouter +from fastapi import APIRouter, HTTPException, status router = APIRouter(prefix="/abspacken", tags=["abspacken"]) async def get_kurix(kgs: float) -> float: + # die berechnung ist sehr aufwändig, braucht lange! await asyncio.sleep(2) return kgs / 1.13 @@ -25,3 +26,26 @@ async def uwe( @router.get("/torsten/{ding}") async def torsten(ding: str) -> str: return "Der Alphakevin Torsten hat ein " f"langes {ding}." + + +@router.get( + "/kys", + responses={ + status.HTTP_200_OK: { + "description": "Success", + "content": None, + }, + status.HTTP_418_IM_A_TEAPOT: { + "description": "Commit Sudoku", + "content": None, + } + } +) +async def kys() -> None: + """ + Sinnlose Todesdrohungen. + + Heiße Botschaften aus der Nachbarschaft warten auf Sie. + """ + + raise HTTPException(status.HTTP_418_IM_A_TEAPOT, "Go kill yourself")