sumo-wrapper-python 1.0.16__tar.gz → 1.0.17__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of sumo-wrapper-python might be problematic. Click here for more details.
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/PKG-INFO +1 -1
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/src/sumo/wrapper/_auth_provider.py +13 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/src/sumo/wrapper/_version.py +2 -2
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/src/sumo/wrapper/sumo_client.py +34 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/src/sumo_wrapper_python.egg-info/PKG-INFO +1 -1
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/.github/workflows/build_docs.yaml +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/.github/workflows/linting.yml +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/.github/workflows/publish_release.yml +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/.github/workflows/pytest.yml +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/.gitignore +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/.pre-commit-config.yaml +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/.readthedocs.yaml +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/CONTRIBUTING.md +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/LICENSE +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/README.md +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/SECURITY.md +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/docs/Makefile +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/docs/_static/equinor-logo.png +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/docs/_static/equinor-logo2.jpg +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/docs/_static/equinor_logo.jpg +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/docs/_static/equinor_logo_only.jpg +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/docs/_templates/layout.html +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/docs/api.rst +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/docs/conf.py +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/docs/index.rst +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/docs/make.bat +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/docs/sumo-wrapper-python.rst +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/pyproject.toml +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/setup.cfg +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/src/sumo/__init__.py +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/src/sumo/wrapper/__init__.py +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/src/sumo/wrapper/_blob_client.py +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/src/sumo/wrapper/_decorators.py +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/src/sumo/wrapper/_logging.py +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/src/sumo/wrapper/_retry_strategy.py +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/src/sumo/wrapper/config.py +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/src/sumo/wrapper/login.py +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/src/sumo_wrapper_python.egg-info/SOURCES.txt +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/src/sumo_wrapper_python.egg-info/dependency_links.txt +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/src/sumo_wrapper_python.egg-info/entry_points.txt +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/src/sumo_wrapper_python.egg-info/requires.txt +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/src/sumo_wrapper_python.egg-info/top_level.txt +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/tests/conftest.py +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/tests/test_sumo_thin_client.py +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/tests/testdata/case.yml +0 -0
- {sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/tests/testdata/surface.yml +0 -0
{sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/src/sumo/wrapper/_auth_provider.py
RENAMED
|
@@ -66,6 +66,13 @@ class AuthProvider:
|
|
|
66
66
|
|
|
67
67
|
return {"Authorization": "Bearer " + token}
|
|
68
68
|
|
|
69
|
+
def store_shared_access_key_for_case(self, case_uuid, token):
|
|
70
|
+
with open(
|
|
71
|
+
get_token_path(self._resource_id + "+" + case_uuid, ".sharedkey"),
|
|
72
|
+
"w",
|
|
73
|
+
) as f:
|
|
74
|
+
f.write(token)
|
|
75
|
+
|
|
69
76
|
pass
|
|
70
77
|
|
|
71
78
|
|
|
@@ -394,6 +401,7 @@ def get_auth_provider(
|
|
|
394
401
|
access_token=None,
|
|
395
402
|
refresh_token=None,
|
|
396
403
|
devicecode=False,
|
|
404
|
+
case_uuid=None,
|
|
397
405
|
):
|
|
398
406
|
if refresh_token:
|
|
399
407
|
return AuthProviderRefreshToken(
|
|
@@ -403,6 +411,11 @@ def get_auth_provider(
|
|
|
403
411
|
if access_token:
|
|
404
412
|
return AuthProviderAccessToken(access_token)
|
|
405
413
|
# ELSE
|
|
414
|
+
if case_uuid is not None and os.path.exists(
|
|
415
|
+
get_token_path(resource_id + "+" + case_uuid, ".sharedkey")
|
|
416
|
+
):
|
|
417
|
+
return AuthProviderSumoToken(resource_id + "+" + case_uuid)
|
|
418
|
+
# ELSE
|
|
406
419
|
if os.path.exists(get_token_path(resource_id, ".sharedkey")):
|
|
407
420
|
return AuthProviderSumoToken(resource_id)
|
|
408
421
|
# ELSE
|
|
@@ -33,6 +33,7 @@ class SumoClient:
|
|
|
33
33
|
verbosity: str = "CRITICAL",
|
|
34
34
|
retry_strategy=RetryStrategy(),
|
|
35
35
|
timeout=DEFAULT_TIMEOUT,
|
|
36
|
+
case_uuid=None,
|
|
36
37
|
):
|
|
37
38
|
"""Initialize a new Sumo object
|
|
38
39
|
|
|
@@ -49,6 +50,9 @@ class SumoClient:
|
|
|
49
50
|
if env not in APP_REGISTRATION:
|
|
50
51
|
raise ValueError(f"Invalid environment: {env}")
|
|
51
52
|
|
|
53
|
+
self.env = env
|
|
54
|
+
self._verbosity = verbosity
|
|
55
|
+
|
|
52
56
|
self._retry_strategy = retry_strategy
|
|
53
57
|
self._client = httpx.Client()
|
|
54
58
|
self._async_client = httpx.AsyncClient()
|
|
@@ -85,6 +89,7 @@ class SumoClient:
|
|
|
85
89
|
refresh_token=refresh_token,
|
|
86
90
|
access_token=access_token,
|
|
87
91
|
devicecode=devicecode,
|
|
92
|
+
case_uuid=case_uuid,
|
|
88
93
|
)
|
|
89
94
|
|
|
90
95
|
if env == "localhost":
|
|
@@ -398,6 +403,35 @@ class SumoClient:
|
|
|
398
403
|
pass
|
|
399
404
|
return logger
|
|
400
405
|
|
|
406
|
+
def create_shared_access_key_for_case(self, case_uuid):
|
|
407
|
+
"""Creates and stores a shared access key that can be used to access
|
|
408
|
+
the case identified by *case_uuid*, in the current Sumo environment.
|
|
409
|
+
|
|
410
|
+
This shared access key can then be used by instantiating
|
|
411
|
+
SumoClient with the parameter case_uuid set accordingly.
|
|
412
|
+
|
|
413
|
+
Args:
|
|
414
|
+
case_uuid: the uuid for a case.
|
|
415
|
+
|
|
416
|
+
Side effects:
|
|
417
|
+
Creates a new file in ~/.sumo, named {app_id}+{case_uuid}
|
|
418
|
+
"""
|
|
419
|
+
token = self.get(
|
|
420
|
+
f"/objects('{case_uuid}')/make-shared-access-key"
|
|
421
|
+
).text
|
|
422
|
+
self.auth.store_shared_access_key_for_case(case_uuid, token)
|
|
423
|
+
|
|
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(
|
|
428
|
+
env=self.env,
|
|
429
|
+
verbosity=self._verbosity,
|
|
430
|
+
retry_strategy=self._retry_strategy,
|
|
431
|
+
timeout=self._timeout,
|
|
432
|
+
case_uuid=case_uuid,
|
|
433
|
+
)
|
|
434
|
+
|
|
401
435
|
@raise_for_status_async
|
|
402
436
|
async def get_async(self, path: str, params: dict = None):
|
|
403
437
|
"""Performs an async GET-request to the Sumo API.
|
|
File without changes
|
|
File without changes
|
{sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/.github/workflows/publish_release.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/docs/_static/equinor_logo_only.jpg
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sumo_wrapper_python-1.0.16 → sumo_wrapper_python-1.0.17}/src/sumo/wrapper/_retry_strategy.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|