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 }