Update code in endpoints/whatsapp.get.py
This commit is contained in:
parent
31b6754c7b
commit
f165641c48
@ -0,0 +1,27 @@
|
||||
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"
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user