sumo-wrapper-python 1.0.8__tar.gz → 1.0.10__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.

Files changed (48) hide show
  1. sumo_wrapper_python-1.0.10/.github/workflows/build_docs.yaml +34 -0
  2. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/.github/workflows/linting.yml +4 -4
  3. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/.github/workflows/publish_release.yml +2 -2
  4. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/.github/workflows/pytest.yml +5 -5
  5. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/.gitignore +1 -1
  6. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/PKG-INFO +11 -155
  7. sumo_wrapper_python-1.0.10/README.md +11 -0
  8. sumo_wrapper_python-1.0.10/docs/_static/equinor-logo.png +0 -0
  9. sumo_wrapper_python-1.0.10/docs/_static/equinor-logo2.jpg +0 -0
  10. sumo_wrapper_python-1.0.10/docs/_static/equinor_logo.jpg +0 -0
  11. sumo_wrapper_python-1.0.10/docs/_static/equinor_logo_only.jpg +0 -0
  12. sumo_wrapper_python-1.0.10/docs/_templates/layout.html +17 -0
  13. sumo_wrapper_python-1.0.10/docs/api.rst +9 -0
  14. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/docs/conf.py +14 -12
  15. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/docs/index.rst +5 -14
  16. sumo_wrapper_python-1.0.10/docs/sumo-wrapper-python.rst +129 -0
  17. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/pyproject.toml +8 -2
  18. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/src/sumo/wrapper/_auth_provider.py +68 -22
  19. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/src/sumo/wrapper/_blob_client.py +10 -8
  20. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/src/sumo/wrapper/_decorators.py +6 -0
  21. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/src/sumo/wrapper/_logging.py +3 -0
  22. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/src/sumo/wrapper/_version.py +2 -2
  23. sumo_wrapper_python-1.0.10/src/sumo/wrapper/login.py +104 -0
  24. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/src/sumo/wrapper/sumo_client.py +85 -44
  25. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/src/sumo_wrapper_python.egg-info/PKG-INFO +11 -155
  26. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/src/sumo_wrapper_python.egg-info/SOURCES.txt +8 -0
  27. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/src/sumo_wrapper_python.egg-info/requires.txt +4 -1
  28. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/tests/testdata/surface.yml +4 -1
  29. sumo-wrapper-python-1.0.8/README.md +0 -158
  30. sumo-wrapper-python-1.0.8/src/sumo/wrapper/login.py +0 -79
  31. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/.flake8 +0 -0
  32. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/.readthedocs.yaml +0 -0
  33. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/CONTRIBUTING.md +0 -0
  34. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/LICENSE +0 -0
  35. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/SECURITY.md +0 -0
  36. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/conftest.py +0 -0
  37. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/docs/Makefile +0 -0
  38. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/docs/make.bat +0 -0
  39. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/setup.cfg +0 -0
  40. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/src/sumo/__init__.py +0 -0
  41. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/src/sumo/wrapper/__init__.py +0 -0
  42. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/src/sumo/wrapper/_retry_strategy.py +0 -0
  43. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/src/sumo/wrapper/config.py +0 -0
  44. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/src/sumo_wrapper_python.egg-info/dependency_links.txt +0 -0
  45. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/src/sumo_wrapper_python.egg-info/entry_points.txt +0 -0
  46. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/src/sumo_wrapper_python.egg-info/top_level.txt +0 -0
  47. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/tests/test_sumo_thin_client.py +0 -0
  48. {sumo-wrapper-python-1.0.8 → sumo_wrapper_python-1.0.10}/tests/testdata/case.yml +0 -0
@@ -0,0 +1,34 @@
1
+ # Build the docs here, to show errors.
2
+ # The actual deployment of docs is configured in ReadTheDocs.org.
3
+
4
+ name: Build and deploy docs
5
+
6
+ on:
7
+ pull_request:
8
+ branches: [main]
9
+ push:
10
+ branches: [main]
11
+
12
+ jobs:
13
+ build_pywheels:
14
+ name: Build docs with Python ${{ matrix.python-version }} on ${{ matrix.os }}
15
+ runs-on: ${{ matrix.os }}
16
+ strategy:
17
+ matrix:
18
+ python-version: ["3.10"]
19
+ os: [ubuntu-latest]
20
+
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version: ${{ matrix.python-version }}
28
+
29
+ - name: Install and build docs
30
+ run: |
31
+ pip install pip -U && pip install wheel -U
32
+ pip install .[docs]
33
+ pip list
34
+ sphinx-build docs build/sphinx/html
@@ -11,9 +11,9 @@ jobs:
11
11
  matrix:
12
12
  python-version: ["3.8"]
13
13
  steps:
14
- - uses: actions/checkout@v3
14
+ - uses: actions/checkout@v4
15
15
  - name: Set up Python ${{ matrix.python-version }}
16
- uses: actions/setup-python@v3
16
+ uses: actions/setup-python@v5
17
17
  with:
18
18
  python-version: ${{ matrix.python-version }}
19
19
  - uses: psf/black@stable
@@ -26,9 +26,9 @@ jobs:
26
26
  matrix:
27
27
  python-version: ["3.8"]
28
28
  steps:
29
- - uses: actions/checkout@v3
29
+ - uses: actions/checkout@v4
30
30
  - name: Set up Python ${{ matrix.python-version }}
31
- uses: actions/setup-python@v3
31
+ uses: actions/setup-python@v5
32
32
  with:
33
33
  python-version: ${{ matrix.python-version }}
34
34
  - name: Install dependencies
@@ -13,9 +13,9 @@ jobs:
13
13
  environment: production
14
14
  runs-on: ubuntu-latest
15
15
  steps:
16
- - uses: actions/checkout@v3
16
+ - uses: actions/checkout@v4
17
17
 
18
- - uses: actions/setup-python@v4
18
+ - uses: actions/setup-python@v5
19
19
  with:
20
20
  python-version: "3.8"
21
21
 
@@ -14,24 +14,24 @@ jobs:
14
14
  runs-on: ${{ matrix.os }}
15
15
  strategy:
16
16
  matrix:
17
- python-version: ["3.8", "3.9", "3.10", "3.11"]
18
- os: [ubuntu-latest, windows-latest, macos-latest]
17
+ python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
18
+ os: [ubuntu-latest, windows-latest, macos-13]
19
19
  permissions:
20
20
  contents: read
21
21
  id-token: write
22
22
 
23
23
  steps:
24
- - uses: actions/checkout@v3
24
+ - uses: actions/checkout@v4
25
25
 
26
26
  - name: Azure Login
27
- uses: Azure/login@v1
27
+ uses: Azure/login@v2
28
28
  with:
29
29
  client-id: f96c150d-cacf-4257-9cc9-54b2c68ec4ce
30
30
  tenant-id: 3aa4a235-b6e2-48d5-9195-7fcf05b459b0
31
31
  subscription-id: 87897772-fb27-495f-ae40-486a2df57baa
32
32
 
33
33
  - name: Set up Python
34
- uses: actions/setup-python@v3
34
+ uses: actions/setup-python@v5
35
35
  with:
36
36
  python-version: ${{ matrix.python-version }}
37
37
 
@@ -11,5 +11,5 @@ build
11
11
  .cache/
12
12
  /src/testing.py
13
13
  /docs/_build
14
- /docs/_static
15
14
  /src/sumo/wrapper/version.py
15
+ *_version.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sumo-wrapper-python
3
- Version: 1.0.8
3
+ Version: 1.0.10
4
4
  Summary: Python wrapper for the Sumo API
5
5
  Author: Equinor
6
6
  License: Apache License
@@ -215,7 +215,7 @@ Requires-Dist: msal>=1.20.0
215
215
  Requires-Dist: msal-extensions>=1.0.0
216
216
  Requires-Dist: pyjwt>=2.4.0
217
217
  Requires-Dist: httpx>=0.24.1
218
- Requires-Dist: tenacity>=8.2.2
218
+ Requires-Dist: tenacity!=8.4.0,>=8.2.2
219
219
  Requires-Dist: azure-identity>=1.13.0
220
220
  Provides-Extra: test
221
221
  Requires-Dist: pytest; extra == "test"
@@ -223,162 +223,18 @@ Requires-Dist: PyYAML; extra == "test"
223
223
  Provides-Extra: docs
224
224
  Requires-Dist: sphinx; extra == "docs"
225
225
  Requires-Dist: sphinx-rtd-theme; extra == "docs"
226
+ Requires-Dist: autoapi; extra == "docs"
227
+ Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
228
+ Requires-Dist: sphinxcontrib-apidoc; extra == "docs"
226
229
 
227
230
  # sumo-wrapper-python
228
231
 
229
- Python wrappers for Sumo APIs
232
+ [![Documentation Status](https://readthedocs.org/projects/sumo-wrapper-python/badge/?version=latest)](https://sumo-wrapper-python.readthedocs.io/en/latest/?badge=latest)
233
+ [![SCM Compliance](https://scm-compliance-api.radix.equinor.com/repos/equinor/sumo-wrapper-python/badge)](https://scm-compliance-api.radix.equinor.com/repos/equinor/sumo-wrapper-python/badge)
230
234
 
231
- Want to contribute? Read our [contributing](./CONTRIBUTING.md) guidelines
235
+ ## Documentation and guidelines
236
+ [sumo-wrapper-python documentation](https://sumo-wrapper-python.readthedocs.io/en/latest/)
232
237
 
233
- ## Install:
238
+ ## Contribute
239
+ [Contribution guidelines](./CONTRIBUTING.md)
234
240
 
235
- pip install sumo-wrapper-python
236
-
237
- For internal Equinor users, this package is available through the Komodo
238
- distribution.
239
-
240
- # Table of contents
241
-
242
- - [sumo-wrapper-python](#sumo-wrapper-python)
243
- - [Install:](#install)
244
- - [Table of contents](#table-of-contents)
245
- - [SumoClient](#sumoclient)
246
- - [Initialization](#initialization)
247
- - [Parameters](#parameters)
248
- - [`token` logic](#token-logic)
249
- - [Methods](#methods)
250
- - [get(path, \*\*params)](#getpath-params)
251
- - [post(path, json, blob, params)](#postpath-json-blob-params)
252
- - [put(path, json, blob)](#putpath-json-blob)
253
- - [delete(path)](#deletepath)
254
- - [Async methods](#async-methods)
255
-
256
- # SumoClient
257
-
258
- A thin wrapper class for the Sumo API.
259
-
260
- ### Initialization
261
-
262
- ```python
263
- from sumo.wrapper import SumoClient
264
-
265
- sumo = SumoClient(env="dev")
266
- ```
267
-
268
- ### Parameters
269
-
270
- ```python
271
- class SumoClient:
272
- def __init__(
273
- self,
274
- env:str,
275
- token:str=None,
276
- interactive:bool=False,
277
- verbosity:str="CRITICAL"
278
- ):
279
- ```
280
-
281
- - `env`: sumo environment
282
- - `token`: bearer token or refresh token
283
- - `interactive`: use interactive flow when authenticating
284
- - `verbosity`: "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"
285
-
286
- ###### `token` logic
287
-
288
- If an access token is provided in the `token` parameter, it will be used as long
289
- as it's valid. An error will be raised when it expires.
290
-
291
- If we are unable to decode the provided `token` as a JWT, we treat it as a
292
- refresh token and attempt to use it to retrieve an access token.
293
-
294
- If no `token` is provided, an authentication code flow/interactive flow is
295
- triggered to retrieve a token.
296
-
297
- ## Methods
298
-
299
- `SumoClient` has one method for each HTTP-method that is used in the sumo-core
300
- API. See examples of how to use these methods below.
301
-
302
- All methods accepts a path argument. Path parameters can be interpolated into
303
- the path string. Example:
304
-
305
- ```python
306
- object_id = "1234"
307
-
308
- # GET/objects('{obejctid}')
309
- sumo.get(f"/objects('{object_id}')")
310
- ```
311
-
312
- ### get(path, \*\*params)
313
-
314
- Performs a GET-request to sumo-core. Accepts query parameters as keyword
315
- arguments.
316
-
317
- ```python
318
- # Retrieve userdata
319
- user_data = sumo.get("/userdata")
320
-
321
- # Search for objects
322
- results = sumo.get("/search",
323
- query="class:surface",
324
- size:3,
325
- select=["_id"]
326
- )
327
-
328
- # Get object by id
329
- object_id = "159405ba-0046-b321-55ce-542f383ba5c7"
330
-
331
- obj = sumo.get(f"/objects('{object_id}')")
332
- ```
333
-
334
- ### post(path, json, blob, params)
335
-
336
- Performs a POST-request to sumo-core. Accepts json and blob, but not both at the
337
- same time.
338
-
339
- ```python
340
- # Upload new parent object
341
- parent_object = sumo.post("/objects", json=parent_meta_data)
342
-
343
- # Upload child object
344
- parent_id = parent_object["_id"]
345
-
346
- child_object = sumo.post(f"/objects('{parent_id}')", json=child_meta_data)
347
- ```
348
-
349
- ### put(path, json, blob)
350
-
351
- Performs a PUT-request to sumo-core. Accepts json and blob, but not both at the
352
- same time.
353
-
354
- ```python
355
- # Upload blob to child object
356
- child_id = child_object["_id"]
357
-
358
- sumo.put(f"/objects('{child_id}')/blob", blob=blob)
359
- ```
360
-
361
- ### delete(path)
362
-
363
- Performs a DELETE-request to sumo-core.
364
-
365
- ```python
366
- # Delete blob
367
- sumo.delete(f"/objects('{child_id}')/blob")
368
-
369
- # Delete child object
370
- sumo.delete(f"/objects('{child_id}')")
371
-
372
- # Delete parent object
373
- sumo.delete(f"/objects('{parent_id}')")
374
- ```
375
-
376
- ## Async methods
377
-
378
- `SumoClient` also has *async* alternatives `get_async`, `post_async`, `put_async` and `delete_async`.
379
- These accept the same parameters as their synchronous counterparts, but have to be *awaited*.
380
-
381
- ```python
382
- # Retrieve userdata
383
- user_data = await sumo.get_async("/userdata")
384
- ```
@@ -0,0 +1,11 @@
1
+ # sumo-wrapper-python
2
+
3
+ [![Documentation Status](https://readthedocs.org/projects/sumo-wrapper-python/badge/?version=latest)](https://sumo-wrapper-python.readthedocs.io/en/latest/?badge=latest)
4
+ [![SCM Compliance](https://scm-compliance-api.radix.equinor.com/repos/equinor/sumo-wrapper-python/badge)](https://scm-compliance-api.radix.equinor.com/repos/equinor/sumo-wrapper-python/badge)
5
+
6
+ ## Documentation and guidelines
7
+ [sumo-wrapper-python documentation](https://sumo-wrapper-python.readthedocs.io/en/latest/)
8
+
9
+ ## Contribute
10
+ [Contribution guidelines](./CONTRIBUTING.md)
11
+
@@ -0,0 +1,17 @@
1
+ {% extends "!layout.html" %}
2
+ {% block footer %} {{ super() }}
3
+
4
+ <style>
5
+ /* Sidebar header (and topbar for mobile) */
6
+ .wy-side-nav-search, .wy-nav-top {
7
+ background: #ff1243;
8
+ }
9
+ /* Sidebar */
10
+ .wy-nav-side {
11
+ background: #474747;
12
+ }
13
+ .wy-side-nav-search > div.version {
14
+ color: white;
15
+ }
16
+ </style>
17
+ {% endblock %}
@@ -0,0 +1,9 @@
1
+ API
2
+ ===
3
+
4
+ The details of classes and methods
5
+
6
+ .. automodule:: sumo.wrapper.sumo_client
7
+ :members:
8
+ :undoc-members:
9
+ :show-inheritance:
@@ -13,14 +13,14 @@
13
13
  import os
14
14
  import sys
15
15
 
16
- sys.path.insert(0, os.path.abspath('../src/'))
16
+ sys.path.insert(0, os.path.abspath("../src/"))
17
17
 
18
18
 
19
19
  # -- Project information -----------------------------------------------------
20
20
 
21
- project = 'sumo-wrapper-python'
22
- copyright = '2022, Sudo Team @ Equinor'
23
- author = 'Sudo Team @ Equinor'
21
+ project = "sumo-wrapper-python"
22
+ copyright = "2024, Sudo Team @ Equinor"
23
+ author = "Sudo Team @ Equinor"
24
24
 
25
25
 
26
26
  # -- General configuration ---------------------------------------------------
@@ -28,15 +28,18 @@ author = 'Sudo Team @ Equinor'
28
28
  # Add any Sphinx extension module names here, as strings. They can be
29
29
  # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
30
30
  # ones.
31
- extensions = ['sphinx.ext.napoleon', 'sphinx.ext.autodoc']
31
+ extensions = [
32
+ "sphinx.ext.napoleon",
33
+ "sphinx.ext.autodoc",
34
+ ]
32
35
 
33
36
  # Add any paths that contain templates here, relative to this directory.
34
- templates_path = ['_templates']
37
+ templates_path = ["_templates"]
35
38
 
36
39
  # List of patterns, relative to source directory, that match files and
37
40
  # directories to ignore when looking for source files.
38
41
  # This pattern also affects html_static_path and html_extra_path.
39
- exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
42
+ exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
40
43
 
41
44
 
42
45
  # -- Options for HTML output -------------------------------------------------
@@ -44,13 +47,12 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
44
47
  # The theme to use for HTML and HTML Help pages. See the documentation for
45
48
  # a list of builtin themes.
46
49
  #
47
- html_theme = 'sphinx_rtd_theme'
50
+ html_theme = "sphinx_rtd_theme"
51
+ html_logo = "_static/equinor-logo2.jpg"
48
52
 
49
- html_theme_options = {
50
- "style_nav_header_background": "#C0C0C0",
51
- }
52
53
 
53
54
  # Add any paths that contain custom static files (such as style sheets) here,
54
55
  # relative to this directory. They are copied after the builtin static files,
55
56
  # so a file named "default.css" will overwrite the builtin "default.css".
56
- html_static_path = ['_static']
57
+ html_static_path = ["_static"]
58
+
@@ -3,22 +3,13 @@
3
3
  You can adapt this file completely to your liking, but it should at least
4
4
  contain the root `toctree` directive.
5
5
 
6
- sumo-wrapper-python
7
- ===================
6
+ Welcome to sumo-wrapper-python's documentation!
7
+ ===============================================
8
8
 
9
9
  .. toctree::
10
10
  :maxdepth: 2
11
11
  :caption: Contents:
12
12
 
13
- .. automodule:: sumo.wrapper.sumo_client
14
- :members:
15
- :undoc-members:
16
- :show-inheritance:
17
-
18
- ..
19
- Indices and tables
20
- ==================
21
-
22
- * :ref:`genindex`
23
- * :ref:`modindex`
24
- * :ref:`search`
13
+ self
14
+ sumo-wrapper-python
15
+ api
@@ -0,0 +1,129 @@
1
+ sumo-wrapper-python
2
+ ###################
3
+
4
+ Short introduction
5
+ *******************
6
+
7
+ A thin python wrapper class that can be used by Sumo client applications to
8
+ communicate with the Sumo core server. It has methods for GET, PUT, POST and DELETE,
9
+ and handles authentication and automatic network retries.
10
+
11
+ This is low-level and close to the Sumo API and primarily intended for developers.
12
+ For usage in the FMU context, the higher-level alternative
13
+ `fmu-sumo <https://fmu-sumo.readthedocs.io>`_ is recommended.
14
+
15
+ The Sumo API is described at
16
+ `https://main-sumo-prod.radix.equinor.com/swagger-ui/ <https://main-sumo-prod.radix.equinor.com/swagger-ui/>`_
17
+
18
+ The data model and schema is described at
19
+ `https://fmu-dataio.readthedocs.io/en/latest/datamodel.html <https://fmu-dataio.readthedocs.io/en/latest/datamodel.html>`_
20
+
21
+ Information on Sumo can be found `here <https://doc-sumo-doc-prod.radix.equinor.com/>`_
22
+
23
+ Preconditions
24
+ *************
25
+
26
+ Access
27
+ ------
28
+
29
+ For internal Equinor users: Apply for access to Sumo in Equinor AccessIT, search for Sumo.
30
+
31
+ Install
32
+ *******
33
+
34
+ For internal Equinor users, this package is included in the Komodo distribution.
35
+ For other use cases it can be pip installed directly from PyPI:
36
+
37
+ .. code-block::
38
+
39
+ pip install sumo-wrapper-python
40
+
41
+ Initialization
42
+ **************
43
+
44
+ .. code-block:: python
45
+
46
+ from sumo.wrapper import SumoClient
47
+
48
+ Sumo = SumoClient()
49
+
50
+ `token` logic
51
+ *************
52
+
53
+ No token provided: this will trigger
54
+ an authentication process and then handles token, token refresh and
55
+ re-authentication as automatic as possible. This would be the most common
56
+ usecase.
57
+
58
+ If an access token is provided in the `token` parameter, it will be used as long
59
+ as it's valid. An error will be raised when it expires.
60
+
61
+ If we are unable to decode the provided `token` as a JWT, we treat it as a
62
+ refresh token and attempt to use it to retrieve an access token.
63
+
64
+
65
+ Methods
66
+ *******
67
+
68
+ `SumoClient` has one method for each HTTP-method that is used in the Sumo
69
+ API: GET, PUT, POST and DELETE. In addition a method to get a blob client
70
+ which handles blob contents.
71
+
72
+ The methods accepts a path argument. A path is the path to a
73
+ Sumo `API <https://main-sumo-prod.radix.equinor.com/swagger-ui/>`_ method, for
74
+ example "/search" or "/smda/countries". Path parameters can be added into
75
+ the path string, for example
76
+
77
+ .. code-block:: python
78
+
79
+ f"/objects('{case_uuid}')/search"
80
+
81
+ The Sumo API documentation is available from the Swagger button in
82
+ the Sumo frontend, or you can use this link:
83
+ `https://main-sumo-prod.radix.equinor.com/swagger-ui/ <https://main-sumo-prod.radix.equinor.com/swagger-ui/>`_.
84
+
85
+ Async methods
86
+ *************
87
+
88
+ `SumoClient` also has *async* alternatives `get_async`, `post_async`, `put_async` and `delete_async`.
89
+ These accept the same parameters as their synchronous counterparts, but have to be *awaited*.
90
+
91
+ Usage and examples
92
+ ******************
93
+
94
+ .. code-block:: python
95
+
96
+ from sumo.wrapper import SumoClient
97
+ sumo = SumoClient()
98
+
99
+ # The line above will trigger the authentication process, and
100
+ # the behaviour depends on how long since your last login.
101
+ # It could re-use existing login or it could take you through
102
+ # a full Microsoft authentication process including
103
+ # username, password, two-factor.
104
+
105
+
106
+ # List your Sumo permissions:
107
+ print("My permissions:", sumo.get("/userpermissions").json())
108
+
109
+ # Get the first case from the list of cases you have access to:
110
+ case = sumo.get("/searchroot").json()["hits"]["hits"][0]
111
+ print("Case metadata:", case["_source"])
112
+ case_uuid = case["_source"]["fmu"]["case"]["uuid"]
113
+ print("Case uuid: ", case_uuid)
114
+
115
+ # Get the first child object:
116
+ child = sumo.get(f"/objects('{case_uuid}')/search").json()["hits"]["hits"][0]
117
+ print("Child metadata", child["_source"])
118
+ child_uuid = child["_id"]
119
+ print("Child uuid: ", child_uuid)
120
+
121
+ # Get the binary of the child
122
+ binary_object = sumo.get(f"/objects('{child_uuid}')/blob").content
123
+ print("Size of child binary object:", len(binary_object))
124
+
125
+
126
+ .. toctree::
127
+ :maxdepth: 2
128
+ :caption: Contents:
129
+
@@ -26,13 +26,19 @@ dependencies = [
26
26
  "msal-extensions>=1.0.0",
27
27
  "pyjwt>=2.4.0",
28
28
  "httpx>=0.24.1",
29
- "tenacity>=8.2.2",
29
+ "tenacity>=8.2.2, !=8.4.0",
30
30
  "azure-identity>=1.13.0",
31
31
  ]
32
32
 
33
33
  [project.optional-dependencies]
34
34
  test = ["pytest", "PyYAML"]
35
- docs = ["sphinx", "sphinx-rtd-theme"]
35
+ docs = [
36
+ "sphinx",
37
+ "sphinx-rtd-theme",
38
+ "autoapi",
39
+ "sphinx-autodoc-typehints",
40
+ "sphinxcontrib-apidoc",
41
+ ]
36
42
 
37
43
  [project.urls]
38
44
  Repository = "https://github.com/equinor/sumo-wrapper-python"