Skip to content

Commit

Permalink
Add method for cloning a SumoClient for use with a specific case_uuid.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwiker committed Dec 19, 2024
1 parent c0a76d1 commit 430d545
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/sumo/wrapper/sumo_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def __init__(
raise ValueError(f"Invalid environment: {env}")

self.env = env
self._verbosity = verbosity

self._retry_strategy = retry_strategy
self._client = httpx.Client()
Expand Down Expand Up @@ -420,6 +421,13 @@ def create_shared_access_key_for_case(self, case_uuid):
).text
self.auth.store_shared_access_key_for_case(case_uuid, token)

def client_for_case(self, case_uuid):
"""Instantiate and return new SumoClient for accessing the
case identified by "case_uuid*."""
return SumoClient(env=self.env, verbosity=self._verbosity,
retry_strategy=self._retry_strategy,
timeout=self._timeout, case_uuid=case_uuid)

@raise_for_status_async
async def get_async(self, path: str, params: dict = None):
"""Performs an async GET-request to the Sumo API.
Expand Down

0 comments on commit 430d545

Please sign in to comment.