Update code in endpoints/greatest-showman.get.py
This commit is contained in:
parent
a2890a7a13
commit
2b5481074d
28
endpoints/greatest-showman.get.py
Normal file
28
endpoints/greatest-showman.get.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
from fastapi import APIRouter, HTTPException
|
||||||
|
import random
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
NIGERIAN_STATES = [
|
||||||
|
"Abia", "Adamawa", "Akwa Ibom", "Anambra", "Bauchi", "Bayelsa", "Benue",
|
||||||
|
"Borno", "Cross River", "Delta", "Ebonyi", "Edo", "Ekiti", "Enugu", "Gombe",
|
||||||
|
"Imo", "Jigawa", "Kaduna", "Kano", "Katsina", "Kebbi", "Kogi", "Kwara",
|
||||||
|
"Lagos", "Nasarawa", "Niger", "Ogun", "Ondo", "Osun", "Oyo", "Plateau",
|
||||||
|
"Rivers", "Sokoto", "Taraba", "Yobe", "Zamfara", "FCT"
|
||||||
|
]
|
||||||
|
|
||||||
|
@router.get("/greatest-showman")
|
||||||
|
async def get_random_nigerian_state():
|
||||||
|
"""Fetch a random Nigerian state"""
|
||||||
|
random_state = random.choice(NIGERIAN_STATES)
|
||||||
|
|
||||||
|
return {
|
||||||
|
"message": "State fetched successfully",
|
||||||
|
"data": {
|
||||||
|
"state": random_state
|
||||||
|
},
|
||||||
|
"metadata": {
|
||||||
|
"total_states": len(NIGERIAN_STATES),
|
||||||
|
"source": "nigeria_states_db"
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user