sumo-wrapper-python 1.4.0__tar.gz → 1.5.0__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.
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/PKG-INFO +1 -1
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/src/sumo/wrapper/_auth_provider.py +11 -2
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/src/sumo/wrapper/_decorators.py +8 -4
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/src/sumo/wrapper/_version.py +3 -3
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/src/sumo/wrapper/sumo_client.py +7 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/src/sumo_wrapper_python.egg-info/PKG-INFO +1 -1
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/.github/workflows/build_docs.yaml +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/.github/workflows/linting.yml +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/.github/workflows/publish_release.yml +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/.github/workflows/pytest.yml +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/.gitignore +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/.pre-commit-config.yaml +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/.readthedocs.yaml +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/CONTRIBUTING.md +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/LICENSE +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/README.md +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/SECURITY.md +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/docs/Makefile +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/docs/_static/equinor-logo.png +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/docs/_static/equinor-logo2.jpg +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/docs/_static/equinor_logo.jpg +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/docs/_static/equinor_logo_only.jpg +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/docs/_templates/layout.html +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/docs/api.rst +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/docs/conf.py +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/docs/index.rst +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/docs/make.bat +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/docs/sumo-wrapper-python.rst +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/pyproject.toml +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/setup.cfg +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/src/sumo/__init__.py +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/src/sumo/wrapper/__init__.py +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/src/sumo/wrapper/_blob_client.py +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/src/sumo/wrapper/_logging.py +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/src/sumo/wrapper/_retry_strategy.py +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/src/sumo/wrapper/login.py +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/src/sumo_wrapper_python.egg-info/SOURCES.txt +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/src/sumo_wrapper_python.egg-info/dependency_links.txt +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/src/sumo_wrapper_python.egg-info/entry_points.txt +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/src/sumo_wrapper_python.egg-info/requires.txt +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/src/sumo_wrapper_python.egg-info/top_level.txt +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/tests/conftest.py +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/tests/test_sumo_thin_client.py +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/tests/testdata/case.yml +0 -0
- {sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/tests/testdata/surface.yml +0 -0
|
@@ -99,6 +99,9 @@ class AuthProvider:
|
|
|
99
99
|
get_token_path(self._resource_id, ".sharedkey", case_uuid)
|
|
100
100
|
)
|
|
101
101
|
|
|
102
|
+
def delete_token(self):
|
|
103
|
+
return False
|
|
104
|
+
|
|
102
105
|
pass
|
|
103
106
|
|
|
104
107
|
|
|
@@ -400,9 +403,10 @@ class AuthProviderSumoToken(AuthProvider):
|
|
|
400
403
|
def __init__(self, resource_id, case_uuid=None):
|
|
401
404
|
super().__init__(resource_id)
|
|
402
405
|
protect_token_cache(resource_id, ".sharedkey", case_uuid)
|
|
403
|
-
token_path = get_token_path(resource_id, ".sharedkey", case_uuid)
|
|
404
|
-
with open(token_path, "r") as f:
|
|
406
|
+
self.token_path = get_token_path(resource_id, ".sharedkey", case_uuid)
|
|
407
|
+
with open(self.token_path, "r") as f:
|
|
405
408
|
self._token = f.readline().strip()
|
|
409
|
+
|
|
406
410
|
return
|
|
407
411
|
|
|
408
412
|
def get_token(self):
|
|
@@ -411,6 +415,11 @@ class AuthProviderSumoToken(AuthProvider):
|
|
|
411
415
|
def get_authorization(self):
|
|
412
416
|
return {"X-SUMO-Token": self._token}
|
|
413
417
|
|
|
418
|
+
def delete_token(self):
|
|
419
|
+
if os.path.exists(self.token_path):
|
|
420
|
+
os.unlink(self.token_path)
|
|
421
|
+
return True
|
|
422
|
+
|
|
414
423
|
|
|
415
424
|
@tn.retry(
|
|
416
425
|
retry=tn.retry_if_exception(_maybe_nfs_exception),
|
|
@@ -4,11 +4,13 @@ from functools import wraps
|
|
|
4
4
|
|
|
5
5
|
def raise_for_status(func):
|
|
6
6
|
@wraps(func)
|
|
7
|
-
def wrapper(*args, **kwargs):
|
|
7
|
+
def wrapper(self, *args, **kwargs):
|
|
8
8
|
# FIXME: in newer versions of httpx, raise_for_status() is chainable,
|
|
9
9
|
# so we could simply write
|
|
10
10
|
# return func(*args, **kwargs).raise_for_status()
|
|
11
|
-
response = func(*args, **kwargs)
|
|
11
|
+
response = func(self, *args, **kwargs)
|
|
12
|
+
if response.status_code == 401:
|
|
13
|
+
self._handle_invalid_shared_key()
|
|
12
14
|
response.raise_for_status()
|
|
13
15
|
return response
|
|
14
16
|
|
|
@@ -17,11 +19,13 @@ def raise_for_status(func):
|
|
|
17
19
|
|
|
18
20
|
def raise_for_status_async(func):
|
|
19
21
|
@wraps(func)
|
|
20
|
-
async def wrapper(*args, **kwargs):
|
|
22
|
+
async def wrapper(self, *args, **kwargs):
|
|
21
23
|
# FIXME: in newer versions of httpx, raise_for_status() is chainable,
|
|
22
24
|
# so we could simply write
|
|
23
25
|
# return func(*args, **kwargs).raise_for_status()
|
|
24
|
-
response = await func(*args, **kwargs)
|
|
26
|
+
response = await func(self, *args, **kwargs)
|
|
27
|
+
if response.status_code == 401:
|
|
28
|
+
self._handle_invalid_shared_key()
|
|
25
29
|
response.raise_for_status()
|
|
26
30
|
return response
|
|
27
31
|
|
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '1.
|
|
32
|
-
__version_tuple__ = version_tuple = (1,
|
|
31
|
+
__version__ = version = '1.5.0'
|
|
32
|
+
__version_tuple__ = version_tuple = (1, 5, 0)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'g2790997c5'
|
|
@@ -208,6 +208,13 @@ class SumoClient:
|
|
|
208
208
|
self._retry_strategy,
|
|
209
209
|
)
|
|
210
210
|
|
|
211
|
+
def _handle_invalid_shared_key(self):
|
|
212
|
+
"""Handle the invalid shared key by deleting it."""
|
|
213
|
+
if self.auth.delete_token():
|
|
214
|
+
print(
|
|
215
|
+
"Invalid shared key detected and deleted, run again to reset automatically"
|
|
216
|
+
)
|
|
217
|
+
|
|
211
218
|
@raise_for_status
|
|
212
219
|
def get(self, path: str, params: Optional[Dict] = None) -> httpx.Response:
|
|
213
220
|
"""Performs a GET-request to the Sumo API.
|
|
File without changes
|
|
File without changes
|
{sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/.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
|
|
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
|
|
File without changes
|
{sumo_wrapper_python-1.4.0 → sumo_wrapper_python-1.5.0}/src/sumo_wrapper_python.egg-info/SOURCES.txt
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
|