21 lines
673 B
Python
21 lines
673 B
Python
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("/france")
|
|
async def get_france_states():
|
|
"""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
|
|
} |