27 lines
743 B
Python
27 lines
743 B
Python
from fastapi import APIRouter
|
|
import random
|
|
|
|
african_countries = [
|
|
"Nigeria", "Egypt", "South Africa", "Kenya", "Ethiopia",
|
|
"Ghana", "Tanzania", "Uganda", "Algeria", "Morocco",
|
|
"Zimbabwe", "Zambia", "Rwanda", "Senegal", "Mali",
|
|
"Angola", "Mozambique", "Cameroon", "Niger", "Malawi"
|
|
]
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/whatsapp")
|
|
async def get_random_country():
|
|
"""Returns random African country"""
|
|
country = random.choice(african_countries)
|
|
|
|
return {
|
|
"method": "GET",
|
|
"_verb": "get",
|
|
"country": country,
|
|
"message": f"Random African country: {country}",
|
|
"features": {
|
|
"total_countries": len(african_countries),
|
|
"region": "Africa"
|
|
}
|
|
} |