Récupération de schéma plus robuste et changelog
This commit is contained in:
@@ -9,6 +9,7 @@ ANNOUNCEMENTS=
|
|||||||
|
|
||||||
# Chemin vers le schéma de données
|
# Chemin vers le schéma de données
|
||||||
DATA_SCHEMA_PATH=https://www.data.gouv.fr/api/1/datasets/r/9a4144c0-ee44-4dec-bee5-bbef38191d9a
|
DATA_SCHEMA_PATH=https://www.data.gouv.fr/api/1/datasets/r/9a4144c0-ee44-4dec-bee5-bbef38191d9a
|
||||||
|
DATA_SCHEMA_PATH_LOCAL=../schema.json
|
||||||
|
|
||||||
# Colonnes masquées par défaut
|
# Colonnes masquées par défaut
|
||||||
DISPLAYED_COLUMNS="uid, acheteur_id, acheteur_nom, montant, objet, titulaire_nom, titulaire_id, dateNotification, dureeMois, acheteur_departement_code, sourceDataset"
|
DISPLAYED_COLUMNS="uid, acheteur_id, acheteur_nom, montant, objet, titulaire_nom, titulaire_id, dateNotification, dureeMois, acheteur_departement_code, sourceDataset"
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
##### 2.7.8 (18 mai 2026)
|
||||||
|
|
||||||
|
- Récupération du schéma de données plus robuste, ne pas dépendre de data.gouv.fr
|
||||||
|
|
||||||
##### 2.7.7 (11 mai 2026)
|
##### 2.7.7 (11 mai 2026)
|
||||||
|
|
||||||
- Suppression des mentions sur les profils d'acheteur. Omnikles/Safetender publie via l'API DUME et Klekoon ne publie pas, mais c'est peut-être pas le seul, donc je préfère supprimer et refaire un tour.
|
- Suppression des mentions sur les profils d'acheteur. Omnikles/Safetender publie via l'API DUME et Klekoon ne publie pas, mais c'est peut-être pas le seul, donc je préfère supprimer et refaire un tour.
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "decp.info"
|
name = "decp.info"
|
||||||
description = "Interface d'exploration et d'analyse des marchés publics français."
|
description = "Interface d'exploration et d'analyse des marchés publics français."
|
||||||
version = "2.7.7"
|
version = "2.7.8"
|
||||||
requires-python = ">= 3.10"
|
requires-python = ">= 3.10"
|
||||||
authors = [{ name = "Colin Maudry", email = "colin@colmo.tech" }]
|
authors = [{ name = "Colin Maudry", email = "colin@colmo.tech" }]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
+20
-9
@@ -2,7 +2,9 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import httpx
|
||||||
import polars as pl
|
import polars as pl
|
||||||
from httpx import HTTPError, get
|
from httpx import HTTPError, get
|
||||||
|
|
||||||
@@ -63,16 +65,25 @@ def get_departement_region(code_postal):
|
|||||||
|
|
||||||
def get_data_schema() -> dict:
|
def get_data_schema() -> dict:
|
||||||
# Récupération du schéma des données tabulaires
|
# Récupération du schéma des données tabulaires
|
||||||
path = os.getenv("DATA_SCHEMA_PATH")
|
url = os.getenv("DATA_SCHEMA_PATH")
|
||||||
if path.startswith("http"):
|
local_path = Path(os.getenv("DATA_SCHEMA_LOCAL", ""))
|
||||||
original_schema: dict = get(
|
|
||||||
os.getenv("DATA_SCHEMA_PATH"), follow_redirects=True
|
original_schema = {}
|
||||||
).json()
|
if url:
|
||||||
elif os.path.exists(path):
|
try:
|
||||||
with open(path) as f:
|
original_schema: dict = get(url, follow_redirects=True).json()
|
||||||
|
except (
|
||||||
|
httpx.ReadTimeout,
|
||||||
|
httpx.ReadError,
|
||||||
|
httpx.ConnectError,
|
||||||
|
httpx.ConnectTimeout,
|
||||||
|
):
|
||||||
|
logger.error(f"Erreur HTTP lors de la récupération du schéma ({url})")
|
||||||
|
|
||||||
|
if os.path.exists(local_path) and original_schema == {}:
|
||||||
|
with open(local_path) as f:
|
||||||
original_schema: dict = json.load(f)
|
original_schema: dict = json.load(f)
|
||||||
else:
|
logger.info(f"Utilisation du schéma local ({local_path})")
|
||||||
raise Exception(f"Chemin vers le schéma invalide: {path}")
|
|
||||||
|
|
||||||
new_schema = OrderedDict()
|
new_schema = OrderedDict()
|
||||||
|
|
||||||
|
|||||||
@@ -760,7 +760,7 @@ wheels = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "decp-info"
|
name = "decp-info"
|
||||||
version = "2.7.6"
|
version = "2.7.7"
|
||||||
source = { virtual = "." }
|
source = { virtual = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "dash", extra = ["compress"] },
|
{ name = "dash", extra = ["compress"] },
|
||||||
|
|||||||
Reference in New Issue
Block a user