Skip to content

Commit 056a4ef

Browse files
committed
fix: add cache for config data from the 'WELL_KNOWN' endpoint.
1 parent cfd9c41 commit 056a4ef

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/sumo/wrapper/sumo_client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
"SUMOCONNECTIONINFO", "https://api.sumo.equinor.com/well-known"
2727
)
2828

29+
well_known = None
30+
2931

3032
class SumoClient:
3133
"""Authenticate and perform requests to the Sumo API."""
@@ -70,8 +72,9 @@ def __init__(
7072
"""
7173

7274
logger.setLevel(verbosity)
73-
74-
well_known = httpx.get(WELL_KNOWN).json()
75+
global well_known
76+
if well_known is None:
77+
well_known = httpx.get(WELL_KNOWN).json()
7578
if env not in well_known["envs"]:
7679
raise ValueError(f"Invalid environment: {env}")
7780

0 commit comments

Comments
 (0)