From 8c14a606a11155db8d5b6f4f47d8305bc73272b8 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Sat, 22 Mar 2025 08:40:35 +0000 Subject: [PATCH] Update code in endpoints/africa.get.py --- endpoints/africa.get.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/endpoints/africa.get.py b/endpoints/africa.get.py index e69de29..05c021c 100644 --- a/endpoints/africa.get.py +++ b/endpoints/africa.get.py @@ -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) + } \ No newline at end of file