summer-time-6qaree/endpoints/tenants.post.py
2025-03-23 14:29:45 +01:00

28 lines
557 B
Python

from fastapi import APIRouter, HTTPException
router = APIRouter()
towns = [
"Memphis",
"Nashville",
"Knoxville",
"Chattanooga",
"Clarksville",
"Murfreesboro",
"Franklin",
"Jackson",
"Johnson City",
"Bartlett"
]
@router.post("/tenants")
async def get_tennessee_towns():
"""Returns list of towns in Tennessee"""
if request.method != "POST":
raise HTTPException(status_code=405, detail="Method Not Allowed")
return {
"method": "POST",
"_verb": "post",
"towns": towns
}