sumo-wrapper-python 1.9.0__tar.gz → 1.11.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.
Files changed (52) hide show
  1. sumo_wrapper_python-1.11.0/.github/workflows/release.yaml +31 -0
  2. sumo_wrapper_python-1.11.0/.release-please-manifest.json +3 -0
  3. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/PKG-INFO +1 -1
  4. sumo_wrapper_python-1.11.0/release-please-config.json +10 -0
  5. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/src/sumo/wrapper/_auth_provider.py +42 -6
  6. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/src/sumo/wrapper/_version.py +3 -3
  7. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/src/sumo/wrapper/sumo_client.py +9 -0
  8. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/src/sumo_wrapper_python.egg-info/PKG-INFO +1 -1
  9. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/src/sumo_wrapper_python.egg-info/SOURCES.txt +3 -0
  10. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/src/sumo_wrapper_python.egg-info/scm_file_list.json +3 -0
  11. sumo_wrapper_python-1.11.0/src/sumo_wrapper_python.egg-info/scm_version.json +8 -0
  12. sumo_wrapper_python-1.9.0/src/sumo_wrapper_python.egg-info/scm_version.json +0 -8
  13. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/.github/pull_request_template.md +0 -0
  14. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/.github/workflows/build_docs.yaml +0 -0
  15. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/.github/workflows/linting.yml +0 -0
  16. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/.github/workflows/publish_release.yml +0 -0
  17. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/.github/workflows/pytest.yml +0 -0
  18. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/.gitignore +0 -0
  19. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/.pre-commit-config.yaml +0 -0
  20. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/.readthedocs.yaml +0 -0
  21. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/CONTRIBUTING.md +0 -0
  22. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/LICENSE +0 -0
  23. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/README.md +0 -0
  24. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/SECURITY.md +0 -0
  25. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/docs/Makefile +0 -0
  26. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/docs/_static/equinor-logo.png +0 -0
  27. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/docs/_static/equinor-logo2.jpg +0 -0
  28. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/docs/_static/equinor_logo.jpg +0 -0
  29. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/docs/_static/equinor_logo_only.jpg +0 -0
  30. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/docs/_templates/layout.html +0 -0
  31. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/docs/api.rst +0 -0
  32. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/docs/conf.py +0 -0
  33. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/docs/index.rst +0 -0
  34. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/docs/make.bat +0 -0
  35. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/docs/sumo-wrapper-python.rst +0 -0
  36. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/pyproject.toml +0 -0
  37. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/setup.cfg +0 -0
  38. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/src/sumo/__init__.py +0 -0
  39. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/src/sumo/wrapper/__init__.py +0 -0
  40. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/src/sumo/wrapper/_blob_client.py +0 -0
  41. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/src/sumo/wrapper/_decorators.py +0 -0
  42. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/src/sumo/wrapper/_logging.py +0 -0
  43. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/src/sumo/wrapper/_retry_strategy.py +0 -0
  44. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/src/sumo/wrapper/login.py +0 -0
  45. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/src/sumo_wrapper_python.egg-info/dependency_links.txt +0 -0
  46. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/src/sumo_wrapper_python.egg-info/entry_points.txt +0 -0
  47. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/src/sumo_wrapper_python.egg-info/requires.txt +0 -0
  48. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/src/sumo_wrapper_python.egg-info/top_level.txt +0 -0
  49. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/tests/conftest.py +0 -0
  50. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/tests/test_sumo_thin_client.py +0 -0
  51. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/tests/testdata/case.yml +0 -0
  52. {sumo_wrapper_python-1.9.0 → sumo_wrapper_python-1.11.0}/tests/testdata/surface.yml +0 -0
@@ -0,0 +1,31 @@
1
+ name: 🔖 Release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ permissions:
9
+ contents: write
10
+ pull-requests: write
11
+ issues: write
12
+
13
+ jobs:
14
+ release-please:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - name: Generate GitHub App token
18
+ id: app-token
19
+ uses: actions/create-github-app-token@v3
20
+ with:
21
+ client-id: ${{ vars.GH_CLIENT_ID }}
22
+ private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
23
+ owner: ${{ github.repository_owner }}
24
+
25
+ - name: Release with release please
26
+ uses: googleapis/release-please-action@v5.0.0
27
+ id: release
28
+ with:
29
+ token: ${{ steps.app-token.outputs.token }}
30
+ config-file: release-please-config.json
31
+ manifest-file: .release-please-manifest.json
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "1.10.0"
3
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sumo-wrapper-python
3
- Version: 1.9.0
3
+ Version: 1.11.0
4
4
  Summary: Python wrapper for the Sumo API
5
5
  Author: Equinor
6
6
  License: Apache License
@@ -0,0 +1,10 @@
1
+ {
2
+ "packages": {
3
+ ".": {
4
+ "release-type": "python"
5
+ }
6
+ },
7
+ "include-component-in-tag": false,
8
+ "include-v-in-tag": false,
9
+ "include-v-in-release-name": false
10
+ }
@@ -9,6 +9,7 @@ from datetime import UTC, datetime, timedelta
9
9
  from pathlib import Path
10
10
  from urllib.parse import parse_qs
11
11
 
12
+ import httpx
12
13
  import jwt
13
14
  import msal
14
15
  import tenacity as tn
@@ -64,7 +65,10 @@ class AuthProvider:
64
65
  retry_error_callback=_return_last_value,
65
66
  before_sleep=_log_retry_info,
66
67
  )
67
- def get_token(self):
68
+ def get_token(self) -> str | None:
69
+ if self._app is None:
70
+ return None
71
+ assert isinstance(self._app, msal.PublicClientApplication)
68
72
  accounts = self._app.get_accounts()
69
73
  if len(accounts) == 0:
70
74
  return None
@@ -81,6 +85,18 @@ class AuthProvider:
81
85
 
82
86
  return {"Authorization": "Bearer " + token}
83
87
 
88
+ def invalidate_access_tokens(self):
89
+ if self._app is not None:
90
+ assert isinstance(self._app, msal.PublicClientApplication)
91
+ assert isinstance(self._app.token_cache, PersistedTokenCache)
92
+ access_tokens = list(
93
+ self._app.token_cache.search(
94
+ self._app.token_cache.CredentialType.ACCESS_TOKEN
95
+ )
96
+ )
97
+ for access_token in access_tokens:
98
+ self._app.token_cache.remove_at(access_token)
99
+
84
100
  def store_shared_access_key_for_case(self, case_uuid, token):
85
101
  os.makedirs(get_token_dir(), mode=0o700, exist_ok=True)
86
102
  with open(
@@ -90,6 +106,17 @@ class AuthProvider:
90
106
  f.write(token)
91
107
  protect_token_cache(self._resource_id, ".sharedkey", case_uuid)
92
108
 
109
+ def _store_fallback_auth(self, sumo_client):
110
+ sync_client = sumo_client._client
111
+ if sync_client is None:
112
+ sumo_client._client = httpx.Client()
113
+ token = sumo_client.get("/createfallbackauth").text
114
+ self.store_shared_access_key_for_case("fallback", token)
115
+ sumo_client._client = sync_client
116
+
117
+ def store_fallback_auth(self, sumo_client):
118
+ return
119
+
93
120
  def has_case_token(self, case_uuid):
94
121
  return os.path.exists(
95
122
  get_token_path(self._resource_id, ".sharedkey", case_uuid)
@@ -115,6 +142,9 @@ class AuthProviderSilent(AuthProvider):
115
142
 
116
143
  self._scope = scope_for_resource(resource_id)
117
144
 
145
+ def store_fallback_auth(self, sumo_client):
146
+ self._store_fallback_auth(sumo_client)
147
+
118
148
 
119
149
  class AuthProviderAccessToken(AuthProvider):
120
150
  def __init__(self, access_token):
@@ -268,6 +298,9 @@ class AuthProviderInteractive(AuthProvider):
268
298
  )
269
299
  return
270
300
 
301
+ def store_fallback_auth(self, sumo_client):
302
+ self._store_fallback_auth(sumo_client)
303
+
271
304
 
272
305
  class AuthProviderDeviceCode(AuthProvider):
273
306
  def __init__(self, client_id, authority, resource_id):
@@ -451,12 +484,15 @@ def get_auth_provider(
451
484
  )
452
485
  os.environ["BROWSER"] = "firefox"
453
486
 
454
- return AuthProviderInteractive(client_id, authority, resource_id)
487
+ auth_interactive = AuthProviderInteractive(
488
+ client_id, authority, resource_id
489
+ )
490
+ token = auth_interactive.get_token()
491
+ if token is not None:
492
+ return auth_interactive
455
493
  # ELSE
456
- if devicecode:
457
- # Potential issues with device-code
458
- # under Equinor compliant device policy
459
- return AuthProviderDeviceCode(client_id, authority, resource_id)
494
+ if os.path.exists(get_token_path(resource_id, ".sharedkey", "fallback")):
495
+ return AuthProviderSumoToken(resource_id, "fallback")
460
496
  # ELSE
461
497
  return AuthProviderNone(resource_id)
462
498
 
@@ -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.9.0'
22
- __version_tuple__ = version_tuple = (1, 9, 0)
21
+ __version__ = version = '1.11.0'
22
+ __version_tuple__ = version_tuple = (1, 11, 0)
23
23
 
24
- __commit_id__ = commit_id = 'g9794ea23c'
24
+ __commit_id__ = commit_id = 'gefa843be7'
@@ -149,7 +149,11 @@ class SumoClient:
149
149
 
150
150
  self.base_url = base_url
151
151
 
152
+ with contextlib.suppress(Exception):
153
+ self.auth.store_fallback_auth(self)
154
+
152
155
  def __enter__(self):
156
+
153
157
  return self
154
158
 
155
159
  def __exit__(self, *_):
@@ -184,6 +188,11 @@ class SumoClient:
184
188
  return None
185
189
  return self.auth.get_token()
186
190
 
191
+ def invalidate_access_tokens(self):
192
+ if self.auth is None:
193
+ return None
194
+ return self.auth.invalidate_access_tokens()
195
+
187
196
  @property
188
197
  def blob_client(self) -> BlobClient:
189
198
  """Get blob_client
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sumo-wrapper-python
3
- Version: 1.9.0
3
+ Version: 1.11.0
4
4
  Summary: Python wrapper for the Sumo API
5
5
  Author: Equinor
6
6
  License: Apache License
@@ -1,16 +1,19 @@
1
1
  .gitignore
2
2
  .pre-commit-config.yaml
3
3
  .readthedocs.yaml
4
+ .release-please-manifest.json
4
5
  CONTRIBUTING.md
5
6
  LICENSE
6
7
  README.md
7
8
  SECURITY.md
8
9
  pyproject.toml
10
+ release-please-config.json
9
11
  .github/pull_request_template.md
10
12
  .github/workflows/build_docs.yaml
11
13
  .github/workflows/linting.yml
12
14
  .github/workflows/publish_release.yml
13
15
  .github/workflows/pytest.yml
16
+ .github/workflows/release.yaml
14
17
  docs/Makefile
15
18
  docs/api.rst
16
19
  docs/conf.py
@@ -5,9 +5,11 @@
5
5
  ".github/workflows/linting.yml",
6
6
  ".github/workflows/publish_release.yml",
7
7
  ".github/workflows/pytest.yml",
8
+ ".github/workflows/release.yaml",
8
9
  ".gitignore",
9
10
  ".pre-commit-config.yaml",
10
11
  ".readthedocs.yaml",
12
+ ".release-please-manifest.json",
11
13
  "CONTRIBUTING.md",
12
14
  "LICENSE",
13
15
  "README.md",
@@ -24,6 +26,7 @@
24
26
  "docs/make.bat",
25
27
  "docs/sumo-wrapper-python.rst",
26
28
  "pyproject.toml",
29
+ "release-please-config.json",
27
30
  "src/sumo/__init__.py",
28
31
  "src/sumo/wrapper/__init__.py",
29
32
  "src/sumo/wrapper/_auth_provider.py",
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "1.11.0",
3
+ "distance": 0,
4
+ "node": "gefa843be749cea5401af13f30648b00433056fc7",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-10-30"
8
+ }
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "1.9.0",
3
- "distance": 0,
4
- "node": "g9794ea23c4f43359681ec0938b0630d82ed4c4ba",
5
- "dirty": false,
6
- "branch": "HEAD",
7
- "node_date": "2026-08-11"
8
- }