Update code in endpoints/kenya.get.py
This commit is contained in:
parent
3dea6ceffc
commit
a53339d61c
24
endpoints/kenya.get.py
Normal file
24
endpoints/kenya.get.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
from fastapi import APIRouter, HTTPException
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
west_nigeria_states = [
|
||||||
|
"Ekiti",
|
||||||
|
"Lagos",
|
||||||
|
"Ogun",
|
||||||
|
"Ondo",
|
||||||
|
"Osun",
|
||||||
|
"Oyo"
|
||||||
|
]
|
||||||
|
|
||||||
|
@router.get("/kenya", response_model=dict)
|
||||||
|
async def get_west_nigeria_states():
|
||||||
|
"""Returns list of states in west Nigeria"""
|
||||||
|
if request.method != "GET":
|
||||||
|
raise HTTPException(status_code=405, detail="Method Not Allowed")
|
||||||
|
|
||||||
|
return {
|
||||||
|
"method": "GET",
|
||||||
|
"_verb": "get",
|
||||||
|
"west_nigeria_states": west_nigeria_states
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user