Update code in endpoints/call.post.py
This commit is contained in:
parent
b9c8bc184a
commit
a760476616
28
endpoints/call.post.py
Normal file
28
endpoints/call.post.py
Normal 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
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user