From a760476616794c9ec2b3da1f721226d0ad212fc4 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Sun, 23 Mar 2025 14:31:22 +0100 Subject: [PATCH] Update code in endpoints/call.post.py --- endpoints/call.post.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 endpoints/call.post.py diff --git a/endpoints/call.post.py b/endpoints/call.post.py new file mode 100644 index 0000000..3e2a0eb --- /dev/null +++ b/endpoints/call.post.py @@ -0,0 +1,28 @@ +from fastapi import APIRouter, HTTPException + +router = APIRouter() + +towns_in_arizona = [ + "Phoenix", + "Tucson", + "Mesa", + "Chandler", + "Glendale", + "Scottsdale", + "Gilbert", + "Tempe", + "Peoria", + "Surprise" +] + +@router.post("/call", status_code=200) +async def get_towns_in_arizona(): + """Returns list of towns in Arizona""" + if request.method != "POST": + raise HTTPException(status_code=405, detail="Method Not Allowed") + + return { + "method": "POST", + "_verb": "post", + "towns": towns_in_arizona + } \ No newline at end of file