Skip to content

Commit 9a70338

Browse files
committed
Add method for cloning a SumoClient for use with a specific case_uuid.
1 parent 4f7b74c commit 9a70338

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/sumo/wrapper/sumo_client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def __init__(
5151
raise ValueError(f"Invalid environment: {env}")
5252

5353
self.env = env
54+
self._verbosity = verbosity
5455

5556
self._retry_strategy = retry_strategy
5657
self._client = httpx.Client()
@@ -420,6 +421,13 @@ def create_shared_access_key_for_case(self, case_uuid):
420421
).text
421422
self.auth.store_shared_access_key_for_case(case_uuid, token)
422423

424+
def client_for_case(self, case_uuid):
425+
"""Instantiate and return new SumoClient for accessing the
426+
case identified by "case_uuid*."""
427+
return SumoClient(env=self.env, verbosity=self._verbosity,
428+
retry_strategy=self._retry_strategy,
429+
timeout=self._timeout, case_uuid=case_uuid)
430+
423431
@raise_for_status_async
424432
async def get_async(self, path: str, params: dict = None):
425433
"""Performs an async GET-request to the Sumo API.

0 commit comments

Comments
 (0)