From d5844927bdbf00b1f3f523cc84a288561b9ea178 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Sun, 23 Mar 2025 09:03:25 +0100 Subject: [PATCH] Update code in endpoints/canada.post.py --- endpoints/canada.post.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 endpoints/canada.post.py diff --git a/endpoints/canada.post.py b/endpoints/canada.post.py new file mode 100644 index 0000000..60e96c3 --- /dev/null +++ b/endpoints/canada.post.py @@ -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 + } \ No newline at end of file