From 056a4ef3632e92ea534df144b1c7ae43e8495bf1 Mon Sep 17 00:00:00 2001 From: Raymond Wiker Date: Wed, 13 May 2026 09:47:52 +0200 Subject: [PATCH] fix: add cache for config data from the 'WELL_KNOWN' endpoint. --- src/sumo/wrapper/sumo_client.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/sumo/wrapper/sumo_client.py b/src/sumo/wrapper/sumo_client.py index c8780a7..77272b5 100644 --- a/src/sumo/wrapper/sumo_client.py +++ b/src/sumo/wrapper/sumo_client.py @@ -26,6 +26,8 @@ "SUMOCONNECTIONINFO", "https://api.sumo.equinor.com/well-known" ) +well_known = None + class SumoClient: """Authenticate and perform requests to the Sumo API.""" @@ -70,8 +72,9 @@ def __init__( """ logger.setLevel(verbosity) - - well_known = httpx.get(WELL_KNOWN).json() + global well_known + if well_known is None: + well_known = httpx.get(WELL_KNOWN).json() if env not in well_known["envs"]: raise ValueError(f"Invalid environment: {env}")