sumo-wrapper-python 1.7.0__tar.gz → 1.8.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.7.0 → sumo_wrapper_python-1.8.0}/PKG-INFO +1 -1
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/src/sumo/wrapper/_logging.py +3 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/src/sumo/wrapper/_retry_strategy.py +10 -3
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/src/sumo/wrapper/_version.py +3 -3
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/src/sumo/wrapper/sumo_client.py +58 -17
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/src/sumo_wrapper_python.egg-info/PKG-INFO +1 -1
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/.github/pull_request_template.md +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/.github/workflows/build_docs.yaml +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/.github/workflows/linting.yml +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/.github/workflows/publish_release.yml +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/.github/workflows/pytest.yml +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/.gitignore +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/.pre-commit-config.yaml +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/.readthedocs.yaml +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/CONTRIBUTING.md +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/LICENSE +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/README.md +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/SECURITY.md +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/docs/Makefile +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/docs/_static/equinor-logo.png +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/docs/_static/equinor-logo2.jpg +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/docs/_static/equinor_logo.jpg +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/docs/_static/equinor_logo_only.jpg +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/docs/_templates/layout.html +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/docs/api.rst +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/docs/conf.py +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/docs/index.rst +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/docs/make.bat +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/docs/sumo-wrapper-python.rst +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/pyproject.toml +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/setup.cfg +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/src/sumo/__init__.py +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/src/sumo/wrapper/__init__.py +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/src/sumo/wrapper/_auth_provider.py +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/src/sumo/wrapper/_blob_client.py +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/src/sumo/wrapper/_decorators.py +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/src/sumo/wrapper/login.py +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/src/sumo_wrapper_python.egg-info/SOURCES.txt +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/src/sumo_wrapper_python.egg-info/dependency_links.txt +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/src/sumo_wrapper_python.egg-info/entry_points.txt +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/src/sumo_wrapper_python.egg-info/requires.txt +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/src/sumo_wrapper_python.egg-info/top_level.txt +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/tests/conftest.py +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/tests/test_sumo_thin_client.py +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/tests/testdata/case.yml +0 -0
- {sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.0}/tests/testdata/surface.yml +0 -0
|
@@ -28,6 +28,9 @@ class LogHandlerSumo(logging.Handler):
|
|
|
28
28
|
if "objectUuid" in record.__dict__:
|
|
29
29
|
json["objectUuid"] = record.__dict__.get("objectUuid")
|
|
30
30
|
|
|
31
|
+
if "details" in record.__dict__:
|
|
32
|
+
json["details"] = record.__dict__.get("details")
|
|
33
|
+
|
|
31
34
|
self._sumoClient.post("/message-log/new", json=json)
|
|
32
35
|
except Exception:
|
|
33
36
|
# Never fail on logging
|
|
@@ -38,10 +38,17 @@ def _return_last_value(retry_state):
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
class RetryStrategy:
|
|
41
|
-
def __init__(
|
|
41
|
+
def __init__(
|
|
42
|
+
self,
|
|
43
|
+
stop_after=6,
|
|
44
|
+
multiplier=0.5,
|
|
45
|
+
exp_base=2,
|
|
46
|
+
before_sleep=_log_retry_info,
|
|
47
|
+
):
|
|
42
48
|
self._stop_after = stop_after
|
|
43
49
|
self._multiplier = multiplier
|
|
44
50
|
self._exp_base = exp_base
|
|
51
|
+
self._before_sleep = before_sleep
|
|
45
52
|
return
|
|
46
53
|
|
|
47
54
|
def make_retryer(self) -> tn.Retrying:
|
|
@@ -60,7 +67,7 @@ class RetryStrategy:
|
|
|
60
67
|
)
|
|
61
68
|
),
|
|
62
69
|
retry_error_callback=_return_last_value,
|
|
63
|
-
before_sleep=
|
|
70
|
+
before_sleep=self._before_sleep,
|
|
64
71
|
)
|
|
65
72
|
|
|
66
73
|
def make_retryer_async(self) -> tn.AsyncRetrying:
|
|
@@ -79,5 +86,5 @@ class RetryStrategy:
|
|
|
79
86
|
)
|
|
80
87
|
),
|
|
81
88
|
retry_error_callback=_return_last_value,
|
|
82
|
-
before_sleep=
|
|
89
|
+
before_sleep=self._before_sleep,
|
|
83
90
|
)
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '1.
|
|
22
|
-
__version_tuple__ = version_tuple = (1,
|
|
21
|
+
__version__ = version = '1.8.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (1, 8, 0)
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'gd3b39bc3e'
|
|
@@ -219,7 +219,12 @@ class SumoClient:
|
|
|
219
219
|
)
|
|
220
220
|
|
|
221
221
|
@raise_for_status
|
|
222
|
-
def get(
|
|
222
|
+
def get(
|
|
223
|
+
self,
|
|
224
|
+
path: str,
|
|
225
|
+
params: Optional[Dict] = None,
|
|
226
|
+
retry_strategy: Optional[RetryStrategy] = None,
|
|
227
|
+
) -> httpx.Response:
|
|
223
228
|
"""Performs a GET-request to the Sumo API.
|
|
224
229
|
|
|
225
230
|
Args:
|
|
@@ -277,8 +282,9 @@ class SumoClient:
|
|
|
277
282
|
timeout=self._timeout,
|
|
278
283
|
)
|
|
279
284
|
|
|
280
|
-
retryer =
|
|
281
|
-
|
|
285
|
+
retryer = (
|
|
286
|
+
retry_strategy if retry_strategy else self._retry_strategy
|
|
287
|
+
).make_retryer()
|
|
282
288
|
return retryer(_get)
|
|
283
289
|
|
|
284
290
|
@raise_for_status
|
|
@@ -288,6 +294,7 @@ class SumoClient:
|
|
|
288
294
|
blob: Optional[bytes] = None,
|
|
289
295
|
json: Optional[dict] = None,
|
|
290
296
|
params: Optional[dict] = None,
|
|
297
|
+
retry_strategy: Optional[RetryStrategy] = None,
|
|
291
298
|
) -> httpx.Response:
|
|
292
299
|
"""Performs a POST-request to the Sumo API.
|
|
293
300
|
|
|
@@ -352,7 +359,9 @@ class SumoClient:
|
|
|
352
359
|
timeout=self._timeout,
|
|
353
360
|
)
|
|
354
361
|
|
|
355
|
-
retryer =
|
|
362
|
+
retryer = (
|
|
363
|
+
retry_strategy if retry_strategy else self._retry_strategy
|
|
364
|
+
).make_retryer()
|
|
356
365
|
|
|
357
366
|
return retryer(_post)
|
|
358
367
|
|
|
@@ -362,6 +371,7 @@ class SumoClient:
|
|
|
362
371
|
path: str,
|
|
363
372
|
blob: Optional[bytes] = None,
|
|
364
373
|
json: Optional[dict] = None,
|
|
374
|
+
retry_strategy: Optional[RetryStrategy] = None,
|
|
365
375
|
) -> httpx.Response:
|
|
366
376
|
"""Performs a PUT-request to the Sumo API.
|
|
367
377
|
|
|
@@ -401,13 +411,18 @@ class SumoClient:
|
|
|
401
411
|
timeout=self._timeout,
|
|
402
412
|
)
|
|
403
413
|
|
|
404
|
-
retryer =
|
|
414
|
+
retryer = (
|
|
415
|
+
retry_strategy if retry_strategy else self._retry_strategy
|
|
416
|
+
).make_retryer()
|
|
405
417
|
|
|
406
418
|
return retryer(_put)
|
|
407
419
|
|
|
408
420
|
@raise_for_status
|
|
409
421
|
def delete(
|
|
410
|
-
self,
|
|
422
|
+
self,
|
|
423
|
+
path: str,
|
|
424
|
+
params: Optional[dict] = None,
|
|
425
|
+
retry_strategy: Optional[RetryStrategy] = None,
|
|
411
426
|
) -> httpx.Response:
|
|
412
427
|
"""Performs a DELETE-request to the Sumo API.
|
|
413
428
|
|
|
@@ -441,7 +456,9 @@ class SumoClient:
|
|
|
441
456
|
timeout=self._timeout,
|
|
442
457
|
)
|
|
443
458
|
|
|
444
|
-
retryer =
|
|
459
|
+
retryer = (
|
|
460
|
+
retry_strategy if retry_strategy else self._retry_strategy
|
|
461
|
+
).make_retryer()
|
|
445
462
|
|
|
446
463
|
return retryer(_delete)
|
|
447
464
|
|
|
@@ -460,7 +477,10 @@ class SumoClient:
|
|
|
460
477
|
return location, retry_after
|
|
461
478
|
|
|
462
479
|
def poll(
|
|
463
|
-
self,
|
|
480
|
+
self,
|
|
481
|
+
response_in: httpx.Response,
|
|
482
|
+
timeout=None,
|
|
483
|
+
retry_strategy: Optional[RetryStrategy] = None,
|
|
464
484
|
) -> httpx.Response:
|
|
465
485
|
"""Poll a specific endpoint until a result is obtained.
|
|
466
486
|
|
|
@@ -474,7 +494,7 @@ class SumoClient:
|
|
|
474
494
|
expiry = time.time() + timeout if timeout is not None else None
|
|
475
495
|
while True:
|
|
476
496
|
time.sleep(retry_after)
|
|
477
|
-
response = self.get(location)
|
|
497
|
+
response = self.get(location, retry_strategy=retry_strategy)
|
|
478
498
|
if response.status_code != 202:
|
|
479
499
|
return response
|
|
480
500
|
if expiry is not None and time.time() > expiry:
|
|
@@ -539,7 +559,10 @@ class SumoClient:
|
|
|
539
559
|
|
|
540
560
|
@raise_for_status_async
|
|
541
561
|
async def get_async(
|
|
542
|
-
self,
|
|
562
|
+
self,
|
|
563
|
+
path: str,
|
|
564
|
+
params: Optional[dict] = None,
|
|
565
|
+
retry_strategy: Optional[RetryStrategy] = None,
|
|
543
566
|
) -> httpx.Response:
|
|
544
567
|
"""Performs an async GET-request to the Sumo API.
|
|
545
568
|
|
|
@@ -598,7 +621,9 @@ class SumoClient:
|
|
|
598
621
|
timeout=self._timeout,
|
|
599
622
|
)
|
|
600
623
|
|
|
601
|
-
retryer =
|
|
624
|
+
retryer = (
|
|
625
|
+
retry_strategy if retry_strategy else self._retry_strategy
|
|
626
|
+
).make_retryer_async()
|
|
602
627
|
|
|
603
628
|
return await retryer(_get)
|
|
604
629
|
|
|
@@ -609,6 +634,7 @@ class SumoClient:
|
|
|
609
634
|
blob: Optional[bytes] = None,
|
|
610
635
|
json: Optional[dict] = None,
|
|
611
636
|
params: Optional[dict] = None,
|
|
637
|
+
retry_strategy: Optional[RetryStrategy] = None,
|
|
612
638
|
) -> httpx.Response:
|
|
613
639
|
"""Performs an async POST-request to the Sumo API.
|
|
614
640
|
|
|
@@ -674,7 +700,9 @@ class SumoClient:
|
|
|
674
700
|
timeout=self._timeout,
|
|
675
701
|
)
|
|
676
702
|
|
|
677
|
-
retryer =
|
|
703
|
+
retryer = (
|
|
704
|
+
retry_strategy if retry_strategy else self._retry_strategy
|
|
705
|
+
).make_retryer_async()
|
|
678
706
|
|
|
679
707
|
return await retryer(_post)
|
|
680
708
|
|
|
@@ -684,6 +712,7 @@ class SumoClient:
|
|
|
684
712
|
path: str,
|
|
685
713
|
blob: Optional[bytes] = None,
|
|
686
714
|
json: Optional[dict] = None,
|
|
715
|
+
retry_strategy: Optional[RetryStrategy] = None,
|
|
687
716
|
) -> httpx.Response:
|
|
688
717
|
"""Performs an async PUT-request to the Sumo API.
|
|
689
718
|
|
|
@@ -723,13 +752,18 @@ class SumoClient:
|
|
|
723
752
|
timeout=self._timeout,
|
|
724
753
|
)
|
|
725
754
|
|
|
726
|
-
retryer =
|
|
755
|
+
retryer = (
|
|
756
|
+
retry_strategy if retry_strategy else self._retry_strategy
|
|
757
|
+
).make_retryer_async()
|
|
727
758
|
|
|
728
759
|
return await retryer(_put)
|
|
729
760
|
|
|
730
761
|
@raise_for_status_async
|
|
731
762
|
async def delete_async(
|
|
732
|
-
self,
|
|
763
|
+
self,
|
|
764
|
+
path: str,
|
|
765
|
+
params: Optional[dict] = None,
|
|
766
|
+
retry_strategy: Optional[RetryStrategy] = None,
|
|
733
767
|
) -> httpx.Response:
|
|
734
768
|
"""Performs an async DELETE-request to the Sumo API.
|
|
735
769
|
|
|
@@ -763,12 +797,17 @@ class SumoClient:
|
|
|
763
797
|
timeout=self._timeout,
|
|
764
798
|
)
|
|
765
799
|
|
|
766
|
-
retryer =
|
|
800
|
+
retryer = (
|
|
801
|
+
retry_strategy if retry_strategy else self._retry_strategy
|
|
802
|
+
).make_retryer_async()
|
|
767
803
|
|
|
768
804
|
return await retryer(_delete)
|
|
769
805
|
|
|
770
806
|
async def poll_async(
|
|
771
|
-
self,
|
|
807
|
+
self,
|
|
808
|
+
response_in: httpx.Response,
|
|
809
|
+
timeout=None,
|
|
810
|
+
retry_strategy: Optional[RetryStrategy] = None,
|
|
772
811
|
) -> httpx.Response:
|
|
773
812
|
"""Poll a specific endpoint until a result is obtained.
|
|
774
813
|
|
|
@@ -782,7 +821,9 @@ class SumoClient:
|
|
|
782
821
|
expiry = time.time() + timeout if timeout is not None else None
|
|
783
822
|
while True:
|
|
784
823
|
await asyncio.sleep(retry_after)
|
|
785
|
-
response = await self.get_async(
|
|
824
|
+
response = await self.get_async(
|
|
825
|
+
location, retry_strategy=retry_strategy
|
|
826
|
+
)
|
|
786
827
|
if response.status_code != 202:
|
|
787
828
|
return response
|
|
788
829
|
if expiry is not None and time.time() > expiry:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sumo_wrapper_python-1.7.0 → sumo_wrapper_python-1.8.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.7.0 → sumo_wrapper_python-1.8.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
|