Update code in endpoints/africa.get.py

This commit is contained in:
Backend IM Bot 2025-03-22 08:40:35 +00:00
parent 6ca206415a
commit 8c14a606a1

View File

@ -0,0 +1,24 @@
from fastapi import APIRouter
import random
african_countries = [
"Algeria", "Angola", "Benin", "Botswana", "Burkina Faso", "Burundi", "Cameroon",
"Cape Verde", "Central African Republic", "Chad", "Comoros", "Congo", "Democratic Republic of the Congo",
"Djibouti", "Egypt", "Equatorial Guinea", "Eritrea", "Ethiopia", "Gabon", "Gambia", "Ghana",
"Guinea", "Guinea-Bissau", "Ivory Coast", "Kenya", "Lesotho", "Liberia", "Libya", "Madagascar",
"Malawi", "Mali", "Mauritania", "Mauritius", "Morocco", "Mozambique", "Namibia", "Niger",
"Nigeria", "Rwanda", "Sao Tome and Principe", "Senegal", "Seychelles", "Sierra Leone",
"Somalia", "South Africa", "South Sudan", "Sudan", "Swaziland", "Tanzania", "Togo",
"Tunisia", "Uganda", "Zambia", "Zimbabwe"
]
router = APIRouter()
@router.get("/africa")
async def get_random_african_country():
"""Return a random country in Africa"""
return {
"method": "GET",
"_verb": "get",
"country": random.choice(african_countries)
}