@@ -33,6 +33,7 @@ def __init__(
3333 verbosity : str = "CRITICAL" ,
3434 retry_strategy = RetryStrategy (),
3535 timeout = DEFAULT_TIMEOUT ,
36+ case_uuid = None ,
3637 ):
3738 """Initialize a new Sumo object
3839
@@ -85,6 +86,7 @@ def __init__(
8586 refresh_token = refresh_token ,
8687 access_token = access_token ,
8788 devicecode = devicecode ,
89+ case_uuid = case_uuid ,
8890 )
8991
9092 if env == "localhost" :
@@ -398,6 +400,22 @@ def getLogger(self, name):
398400 pass
399401 return logger
400402
403+ def create_shared_access_key_for_case (self , case_uuid ):
404+ """Creates and stores a shared access key that can be used to access
405+ the case identified by *case_uuid*, in the current Sumo environment.
406+
407+ This shared access key can then be used by instantiating
408+ SumoClient with the parameter case_uuid set accordingly.
409+
410+ Args:
411+ case_uuid: the uuid for a case.
412+
413+ Side effects:
414+ Creates a new file in ~/.sumo, named {app_id}+{case_uuid}
415+ """
416+ token = self .get (f"/objects('{ case_uuid } ')/make-shared-access-key" ).text
417+ self .auth .store_shared_access_key_for_case (case_uuid , token )
418+
401419 @raise_for_status_async
402420 async def get_async (self , path : str , params : dict = None ):
403421 """Performs an async GET-request to the Sumo API.
0 commit comments