Update code in endpoints/open.post.py

This commit is contained in:
Backend IM Bot 2025-03-23 15:59:47 +01:00
parent 2d730b21a0
commit 13b547dd1d

View File

@ -2,7 +2,7 @@ from fastapi import APIRouter, HTTPException
router = APIRouter()
towns = [
towns_in_arizona = [
"Phoenix",
"Tucson",
"Mesa",
@ -15,14 +15,14 @@ towns = [
"Surprise"
]
@router.post("/open")
async def get_arizona_towns():
"""endpoint that returns list of town in arizona"""
@router.post("/open", summary="Returns list of towns in Arizona")
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")
raise HTTPException(status_code=405, detail="Method not allowed")
return {
"method": "POST",
"_verb": "post",
"towns": towns
"towns": towns_in_arizona
}