Update code in endpoints/call.post.py

This commit is contained in:
Backend IM Bot 2025-03-23 14:31:22 +01:00
parent b9c8bc184a
commit a760476616

28
endpoints/call.post.py Normal file
View File

@ -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
}