Update code in endpoints/wahtsup.get.py
This commit is contained in:
parent
d33ae0cb8f
commit
6de50164fb
@ -0,0 +1,24 @@
|
|||||||
|
from fastapi import APIRouter
|
||||||
|
import random
|
||||||
|
|
||||||
|
african_countries = [
|
||||||
|
"Nigeria", "Egypt", "South Africa", "Kenya", "Ethiopia",
|
||||||
|
"Ghana", "Morocco", "Tanzania", "Uganda", "Algeria",
|
||||||
|
"Sudan", "Angola", "Mali", "Senegal", "Rwanda"
|
||||||
|
]
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
@router.get("/wahtsup")
|
||||||
|
async def get_random_countries():
|
||||||
|
"""Return random African countries"""
|
||||||
|
selected = random.sample(african_countries, k=3)
|
||||||
|
|
||||||
|
return {
|
||||||
|
"message": "Random African countries retrieved",
|
||||||
|
"countries": selected,
|
||||||
|
"features": {
|
||||||
|
"total_available": len(african_countries),
|
||||||
|
"sample_size": 3
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user