Importation des communes avec leurs arrondissements

This commit is contained in:
Emmy D'Anello 2024-06-13 11:22:23 +02:00
parent 67894a80c3
commit a20411b409
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 6 additions and 6 deletions

View File

@ -14,7 +14,7 @@ def importer_regions(engine: Engine, debug: bool = False) -> None:
"https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets" "https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets"
"/georef-france-region?select=data_processed").json()['data_processed'] "/georef-france-region?select=data_processed").json()['data_processed']
file = get_file("https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets" file = get_file("https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets"
"/georef-france-region/exports/geojson?lang=fr&timezone=Europe%2FBerlin", "/georef-france-region/exports/geojson?lang=fr&timezone=Europe%2FParis",
"georef-france-region.geojson", etag) "georef-france-region.geojson", etag)
with file.open('r') as f: with file.open('r') as f:
@ -41,7 +41,7 @@ def importer_departements(engine: Engine, debug: bool = False) -> None:
"https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets" "https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets"
"/georef-france-departement?select=data_processed").json()['data_processed'] "/georef-france-departement?select=data_processed").json()['data_processed']
file = get_file("https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets" file = get_file("https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets"
"/georef-france-departement/exports/geojson?lang=fr&timezone=Europe%2FBerlin", "/georef-france-departement/exports/geojson?lang=fr&timezone=Europe%2FParis",
"georef-france-departement.geojson", etag) "georef-france-departement.geojson", etag)
@ -69,10 +69,10 @@ def importer_departements(engine: Engine, debug: bool = False) -> None:
def importer_communes(engine: Engine, debug: bool = False) -> None: def importer_communes(engine: Engine, debug: bool = False) -> None:
etag = requests.get( etag = requests.get(
"https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets" "https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets"
"/georef-france-commune?select=data_processed").json()['data_processed'] "/georef-france-commune-arrondissement-municipal?select=data_processed").json()['data_processed']
file = get_file("https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets" file = get_file("https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets"
"/georef-france-commune/exports/geojson?lang=fr&timezone=Europe%2FBerlin", "/georef-france-commune-arrondissement-municipal/exports/geojson?lang=fr&timezone=Europe%2FParis",
"georef-france-commune.geojson", etag) "georef-france-commune-arrondissement-municipal.geojson", etag)
with file.open('r') as f: with file.open('r') as f:
features = json.load(f)['features'] features = json.load(f)['features']
@ -100,7 +100,7 @@ def importer_bureaux_vote(engine: Engine, debug: bool = False) -> None:
"https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets" "https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets"
"/elections-france-bureau-vote-2022?select=data_processed").json()['data_processed'] "/elections-france-bureau-vote-2022?select=data_processed").json()['data_processed']
file = get_file("https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets" file = get_file("https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets"
"/elections-france-bureau-vote-2022/exports/geojson?lang=fr&timezone=Europe%2FBerlin", "/elections-france-bureau-vote-2022/exports/geojson?lang=fr&timezone=Europe%2FParis",
"elections-france-bureau-vote-2022.geojson", etag) "elections-france-bureau-vote-2022.geojson", etag)
with file.open('r') as f: with file.open('r') as f: