Update code in endpoints/greatest-showman.get.py

This commit is contained in:
Backend IM Bot 2025-03-21 02:28:48 +00:00
parent a2890a7a13
commit 2b5481074d

View 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"
}
}