2025-03-23 08:55:35 +01:00

27 lines
569 B
Python

from fastapi import APIRouter, HTTPException
router = APIRouter()
west_nigeria_states = [
"Ekiti",
"Lagos",
"Ogun",
"Ondo",
"Osun",
"Oyo"
]
@router.get("/kenya")
async def get_west_nigeria_states():
"""Returns list of states in west Nigeria"""
if request.method != "GET":
raise HTTPException(status_code=405, detail={
"message": "Method Not Allowed",
"method": request.method,
"_verb": "get"
})
return {
"method": "GET",
"states": west_nigeria_states
}