Update code in endpoints/canada.post.py

This commit is contained in:
Backend IM Bot 2025-03-23 09:03:25 +01:00
parent 68c1b5757a
commit d5844927bd

31
endpoints/canada.post.py Normal file
View File

@ -0,0 +1,31 @@
from fastapi import APIRouter, HTTPException
router = APIRouter()
states_in_france = [
"Auvergne-Rhône-Alpes",
"Bourgogne-Franche-Comté",
"Bretagne",
"Centre-Val de Loire",
"Corse",
"Grand Est",
"Hauts-de-France",
"Île-de-France",
"Normandie",
"Nouvelle-Aquitaine",
"Occitanie",
"Pays de la Loire",
"Provence-Alpes-Côte d'Azur"
]
@router.post("/canada")
async def get_states_in_france():
"""endpoint that returns list of states in France"""
if request.method != "POST":
raise HTTPException(status_code=405, detail="Method Not Allowed")
return {
"method": "POST",
"_verb": "post",
"states": states_in_france
}