From a53339d61cc2ad659f0efdec44068b0d881c6543 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Sun, 23 Mar 2025 08:55:04 +0100 Subject: [PATCH] Update code in endpoints/kenya.get.py --- endpoints/kenya.get.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 endpoints/kenya.get.py diff --git a/endpoints/kenya.get.py b/endpoints/kenya.get.py new file mode 100644 index 0000000..c9c0dd6 --- /dev/null +++ b/endpoints/kenya.get.py @@ -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 + } \ No newline at end of file