Update code in endpoints/countries.get.py
This commit is contained in:
parent
66985717ab
commit
fea0b40757
29
endpoints/countries.get.py
Normal file
29
endpoints/countries.get.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
from fastapi import APIRouter, Depends, HTTPException
|
||||||
|
from core.database import fake_users_db
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
@router.get("/countries")
|
||||||
|
async def african_countries_handler():
|
||||||
|
"""Get list of all African countries"""
|
||||||
|
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"
|
||||||
|
]
|
||||||
|
|
||||||
|
return {
|
||||||
|
"message": "African countries retrieved successfully",
|
||||||
|
"data": african_countries,
|
||||||
|
"metadata": {
|
||||||
|
"total_countries": len(african_countries),
|
||||||
|
"continent": "Africa"
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user