From b8d73c7f7b52ffbeafa058444c3ce8a31bc95041 Mon Sep 17 00:00:00 2001 From: Colin Maudry Date: Fri, 12 Jun 2026 17:58:23 +0200 Subject: [PATCH] fix: omettre temporalCoverage si date inconnue + TimeoutException explicite (#78) Co-Authored-By: Claude Sonnet 4.6 --- src/pages/tableau.py | 6 +++++- src/utils/data.py | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pages/tableau.py b/src/pages/tableau.py index 805dcb0..c6ef4f4 100644 --- a/src/pages/tableau.py +++ b/src/pages/tableau.py @@ -124,7 +124,11 @@ layout = [ "contentUrl": "https://www.data.gouv.fr/api/1/datasets/r/11cea8e8-df3e-4ed1-932b-781e2635e432", }, ], - "temporalCoverage": f"2018-01-01/{update_date_iso[:10]}", + **( + {"temporalCoverage": f"2018-01-01/{update_date_iso[:10]}"} + if update_date_iso + else {} + ), "spatialCoverage": { "@type": "Place", "address": {"countryCode": "FR"}, diff --git a/src/utils/data.py b/src/utils/data.py index 811d7a7..58a9637 100644 --- a/src/utils/data.py +++ b/src/utils/data.py @@ -80,7 +80,12 @@ def _fetch_remote_schema(url: str | None) -> dict | None: return None try: raw = get(url, follow_redirects=True).raise_for_status().json() - except (httpx.HTTPError, httpx.TransportError, json.JSONDecodeError) as e: + except ( + httpx.HTTPError, + httpx.TransportError, + httpx.TimeoutException, + json.JSONDecodeError, + ) as e: logger.error(f"Schéma distant indisponible ({url}) : {e}") return None return _validate_schema(raw)