osducli 0.0.44__tar.gz → 0.0.45__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.
- {osducli-0.0.44/src/osducli.egg-info → osducli-0.0.45}/PKG-INFO +7 -4
- {osducli-0.0.44 → osducli-0.0.45}/README.rst +5 -0
- {osducli-0.0.44 → osducli-0.0.45}/pyproject.toml +16 -3
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/__init__.py +1 -1
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/auth/credentials.py +0 -3
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/auth/msal_non_interactive.py +13 -20
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/wellbore_ddms/_const.py +1 -0
- osducli-0.0.45/src/osducli/commands/wellbore_ddms/well_log/add.py +42 -0
- osducli-0.0.45/src/osducli/commands/wellbore_ddms/well_log/data/__init__.py +13 -0
- osducli-0.0.45/src/osducli/commands/wellbore_ddms/well_log/data/add.py +40 -0
- osducli-0.0.44/src/osducli/commands/wellbore_ddms/well_log/data.py → osducli-0.0.45/src/osducli/commands/wellbore_ddms/well_log/data/get.py +5 -4
- osducli-0.0.44/src/osducli/commands/wellbore_ddms/well_log/record.py → osducli-0.0.45/src/osducli/commands/wellbore_ddms/well_log/get.py +3 -2
- {osducli-0.0.44 → osducli-0.0.45/src/osducli.egg-info}/PKG-INFO +7 -4
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli.egg-info/SOURCES.txt +5 -2
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli.egg-info/requires.txt +1 -3
- {osducli-0.0.44 → osducli-0.0.45}/tests/test_help_text.py +5 -5
- {osducli-0.0.44 → osducli-0.0.45}/LICENSE.md +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/setup.cfg +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/__main__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/auth/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/auth/aws_token_credential.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/auth/msal_interactive.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/auth/token_credential.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/click_cli.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/cliclient.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/config/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/config/consts.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/config/default.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/config/info.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/config/list.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/config/update.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/crs/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/crs/_const.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/crs/areas.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/crs/info.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/crs/list.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/crs/summary.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/crs/transforms.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/dataload/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/dataload/checkrefs.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/dataload/ingest.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/dataload/status.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/dataload/verify.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/entitlements/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/entitlements/_const.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/entitlements/groups/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/entitlements/groups/add.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/entitlements/groups/delete.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/entitlements/groups/members.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/entitlements/info.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/entitlements/members/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/entitlements/members/add.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/entitlements/members/groups.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/entitlements/members/list.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/entitlements/members/remove.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/entitlements/mygroups.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/file/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/file/_const.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/file/download.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/file/info.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/file/metadata.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/legal/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/legal/_const.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/legal/add.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/legal/delete.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/legal/info.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/legal/listtags.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/list/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/list/records.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/schema/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/schema/_const.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/schema/add.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/schema/get.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/schema/info.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/schema/list.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/search/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/search/_const.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/search/id.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/search/info.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/search/kind.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/search/query.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/status/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/status/status.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/storage/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/storage/_const.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/storage/add.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/storage/delete.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/storage/get.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/storage/info.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/storage/list.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/storage/versions.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/unit/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/unit/_const.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/unit/info.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/unit/list.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/version/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/version/version.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/wellbore_ddms/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/wellbore_ddms/info.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/wellbore_ddms/well_log/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/workflow/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/workflow/_const.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/workflow/get.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/workflow/info.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/workflow/list.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/workflow/register.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/workflow/runs.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/workflow/status.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/commands/workflow/unregister.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/config.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/log.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/state.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/util/__init__.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/util/exceptions.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/util/file.py +1 -1
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/util/prompt.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/util/pypi.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/util/service_info.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli/wbddms_client.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli.egg-info/dependency_links.txt +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli.egg-info/entry_points.txt +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/src/osducli.egg-info/top_level.txt +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/tests/test_click_cli_state.py +0 -0
- {osducli-0.0.44 → osducli-0.0.45}/tests/test_cliclient.py +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: osducli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.45
|
|
4
4
|
Summary: OSDU command line
|
|
5
5
|
Author-email: Equinor ASA <mhew@equinor.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -17,7 +17,7 @@ Description-Content-Type: text/x-rst
|
|
|
17
17
|
License-File: LICENSE.md
|
|
18
18
|
Requires-Dist: click
|
|
19
19
|
Requires-Dist: jmespath
|
|
20
|
-
Requires-Dist: osdu-api[all]==0.28
|
|
20
|
+
Requires-Dist: osdu-api[all]==0.28
|
|
21
21
|
Requires-Dist: requests
|
|
22
22
|
Requires-Dist: tabulate
|
|
23
23
|
Requires-Dist: packaging
|
|
@@ -33,8 +33,6 @@ Requires-Dist: google-cloud-storage
|
|
|
33
33
|
Provides-Extra: dev
|
|
34
34
|
Requires-Dist: black; extra == "dev"
|
|
35
35
|
Requires-Dist: isort; extra == "dev"
|
|
36
|
-
Requires-Dist: flake8; extra == "dev"
|
|
37
|
-
Requires-Dist: pep8; extra == "dev"
|
|
38
36
|
Requires-Dist: pylint; extra == "dev"
|
|
39
37
|
Requires-Dist: ruff; extra == "dev"
|
|
40
38
|
Requires-Dist: pytest; extra == "dev"
|
|
@@ -83,6 +81,11 @@ For more information, specify the `-h` flag:
|
|
|
83
81
|
Change Log
|
|
84
82
|
==========
|
|
85
83
|
|
|
84
|
+
0.0.45
|
|
85
|
+
------
|
|
86
|
+
|
|
87
|
+
- Fix msal_non_interactive authentication
|
|
88
|
+
|
|
86
89
|
0.0.44
|
|
87
90
|
------
|
|
88
91
|
|
|
@@ -26,7 +26,7 @@ keywords = ["osdu"]
|
|
|
26
26
|
dependencies = [
|
|
27
27
|
"click",
|
|
28
28
|
"jmespath",
|
|
29
|
-
"osdu-api[all]==0.28
|
|
29
|
+
"osdu-api[all]==0.28",
|
|
30
30
|
"requests",
|
|
31
31
|
"tabulate",
|
|
32
32
|
"packaging",
|
|
@@ -54,8 +54,6 @@ dev = [
|
|
|
54
54
|
"black",
|
|
55
55
|
"isort",
|
|
56
56
|
# linting
|
|
57
|
-
"flake8",
|
|
58
|
-
"pep8",
|
|
59
57
|
"pylint",
|
|
60
58
|
"ruff",
|
|
61
59
|
# testing
|
|
@@ -93,3 +91,18 @@ src = ["src"]
|
|
|
93
91
|
[tool.ruff.lint]
|
|
94
92
|
select = ["E", "F", "W", "I", "B", "UP"]
|
|
95
93
|
ignore = ["E501"]
|
|
94
|
+
|
|
95
|
+
[tool.pylint."messages control"]
|
|
96
|
+
disable = [
|
|
97
|
+
"missing-docstring",
|
|
98
|
+
"protected-access",
|
|
99
|
+
"too-many-arguments",
|
|
100
|
+
"too-many-locals",
|
|
101
|
+
"too-many-branches",
|
|
102
|
+
"too-many-positional-arguments",
|
|
103
|
+
"format",
|
|
104
|
+
"fixme",
|
|
105
|
+
"unknown-option-value",
|
|
106
|
+
"unspecified-encoding",
|
|
107
|
+
"broad-exception-raised"
|
|
108
|
+
]
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
|
|
14
14
|
import os
|
|
15
15
|
|
|
16
|
-
from msal import ConfidentialClientApplication
|
|
17
16
|
from osdu_api.providers.types import BaseCredentials
|
|
18
17
|
|
|
19
18
|
from osducli.auth.aws_token_credential import AwsTokenCredential
|
|
@@ -47,13 +46,11 @@ def msal_non_interactive_credentials(config) -> BaseCredentials:
|
|
|
47
46
|
authority = config.get("core", CONFIG_AUTHENTICATION_AUTHORITY, None)
|
|
48
47
|
scopes = config.get("core", CONFIG_AUTHENTICATION_SCOPES, None)
|
|
49
48
|
client_secret = config.get("core", CONFIG_CLIENT_SECRET, None)
|
|
50
|
-
app = ConfidentialClientApplication(client_id, client_secret, authority)
|
|
51
49
|
credentials = MsalNonInteractiveCredential(
|
|
52
50
|
client_id=client_id,
|
|
53
51
|
client_secret=client_secret,
|
|
54
52
|
authority=authority,
|
|
55
53
|
scopes=scopes,
|
|
56
|
-
client=app,
|
|
57
54
|
)
|
|
58
55
|
return credentials
|
|
59
56
|
|
|
@@ -21,14 +21,13 @@ logger = get_logger(__name__)
|
|
|
21
21
|
class MsalNonInteractiveCredential(BaseCredentials):
|
|
22
22
|
"""Get token based client for connecting with OSDU."""
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
_access_token = None
|
|
25
25
|
|
|
26
26
|
def __init__(self,
|
|
27
27
|
client_id: str,
|
|
28
28
|
client_secret: str,
|
|
29
29
|
authority: str,
|
|
30
|
-
scopes: str
|
|
31
|
-
client: ConfidentialClientApplication):
|
|
30
|
+
scopes: str):
|
|
32
31
|
"""Setup the new client
|
|
33
32
|
|
|
34
33
|
Args:
|
|
@@ -37,32 +36,26 @@ class MsalNonInteractiveCredential(BaseCredentials):
|
|
|
37
36
|
scopes (str): scopes to request
|
|
38
37
|
"""
|
|
39
38
|
super().__init__()
|
|
40
|
-
self._msal_confidential_client = client
|
|
41
39
|
self._client_id = client_id
|
|
42
40
|
self._client_secret = client_secret
|
|
43
41
|
self._authority = authority
|
|
44
42
|
self._scopes = scopes
|
|
43
|
+
self._app = ConfidentialClientApplication(
|
|
44
|
+
self._client_id, self._client_secret, self._authority
|
|
45
|
+
)
|
|
45
46
|
|
|
46
47
|
@property
|
|
47
48
|
def access_token(self) -> str:
|
|
48
|
-
return self.
|
|
49
|
+
return self._access_token
|
|
49
50
|
|
|
50
|
-
def refresh_token(self) -> str:
|
|
51
|
+
def refresh_token(self) -> str:
|
|
51
52
|
"""
|
|
52
53
|
return access_token.
|
|
53
54
|
"""
|
|
54
|
-
|
|
55
|
-
if 'access_token' in
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
response = self._app.acquire_token_for_client(scopes=[self._scopes])
|
|
56
|
+
if 'access_token' in response:
|
|
57
|
+
self._access_token = response['access_token']
|
|
58
|
+
else:
|
|
59
|
+
raise Exception("Failed to aquire token")
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
"""Get token using msal confidential client.
|
|
61
|
-
|
|
62
|
-
Returns:
|
|
63
|
-
dict: Dictionary representing the returned token
|
|
64
|
-
"""
|
|
65
|
-
result = self._msal_confidential_client.acquire_token_silent([self._scopes], account=None)
|
|
66
|
-
if result:
|
|
67
|
-
return result
|
|
68
|
-
return self._msal_confidential_client.acquire_token_for_client([self._scopes])
|
|
61
|
+
return self._access_token
|
|
@@ -16,3 +16,4 @@ WELLBORE_DDMS_SERVICE_NAME = "Wellbore DDMS service"
|
|
|
16
16
|
WELLBORE_DDMS_STATUS_PATH = "/about"
|
|
17
17
|
WELLBORE_DDMS_SWAGGER_PATH = "https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/wellbore/wellbore-domain-services/-/blob/master/spec/generated/openapi.json" # noqa: E501
|
|
18
18
|
WELLBORE_DDMS_DOCUMENTATION = "https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/wellbore/wellbore-domain-services/-/tree/master" # noqa: E501
|
|
19
|
+
WELLBORE_DDMS_WELL_LOG_PATH = "/ddms/v3/welllogs"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
2
|
+
# you may not use this file except in compliance with the License.
|
|
3
|
+
# You may obtain a copy of the License at
|
|
4
|
+
#
|
|
5
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
#
|
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
+
# See the License for the specific language governing permissions and
|
|
11
|
+
# limitations under the License.
|
|
12
|
+
"""Well Log add record command"""
|
|
13
|
+
import json
|
|
14
|
+
|
|
15
|
+
import click
|
|
16
|
+
|
|
17
|
+
from osducli.click_cli import CustomClickCommand, State, command_with_output
|
|
18
|
+
from osducli.cliclient import CliOsduClient, handle_cli_exceptions
|
|
19
|
+
from osducli.commands.wellbore_ddms._const import WELLBORE_DDMS_WELL_LOG_PATH
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# click entry point
|
|
23
|
+
@click.command(cls=CustomClickCommand, help="Add Well Log record")
|
|
24
|
+
@click.option("-f", "--file", "_file", help="WellLog record file to add", required=True)
|
|
25
|
+
@handle_cli_exceptions
|
|
26
|
+
@command_with_output("recordIds")
|
|
27
|
+
def _click_command(state: State, _file: str):
|
|
28
|
+
return add_record(state, _file)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def add_record(state: State, record_file: str):
|
|
32
|
+
"""Add Well Log record"""
|
|
33
|
+
client = CliOsduClient(state.config)
|
|
34
|
+
wellbore_client = client.get_wellbore_ddms_client(url_extra_path=WELLBORE_DDMS_WELL_LOG_PATH)
|
|
35
|
+
|
|
36
|
+
with open(record_file) as file:
|
|
37
|
+
record_data = json.load(file)
|
|
38
|
+
|
|
39
|
+
record_data_list = "[" + json.dumps(record_data) + "]"
|
|
40
|
+
response = wellbore_client.create_well_log(record_data_list)
|
|
41
|
+
client.check_status_code(response)
|
|
42
|
+
return response.json()
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
2
|
+
# you may not use this file except in compliance with the License.
|
|
3
|
+
# You may obtain a copy of the License at
|
|
4
|
+
#
|
|
5
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
#
|
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
+
# See the License for the specific language governing permissions and
|
|
11
|
+
# limitations under the License.
|
|
12
|
+
|
|
13
|
+
"""Wellbore DDMS Well Log data commands"""
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
2
|
+
# you may not use this file except in compliance with the License.
|
|
3
|
+
# You may obtain a copy of the License at
|
|
4
|
+
#
|
|
5
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
#
|
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
+
# See the License for the specific language governing permissions and
|
|
11
|
+
# limitations under the License.
|
|
12
|
+
"""Well Log add data command"""
|
|
13
|
+
import click
|
|
14
|
+
|
|
15
|
+
from osducli.click_cli import CustomClickCommand, State, command_with_output
|
|
16
|
+
from osducli.cliclient import CliOsduClient, handle_cli_exceptions
|
|
17
|
+
from osducli.commands.wellbore_ddms._const import WELLBORE_DDMS_WELL_LOG_PATH
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# click entry point
|
|
21
|
+
@click.command(cls=CustomClickCommand, help="Add Well Log data")
|
|
22
|
+
@click.option("-id", "--id", "_id", help="WellLog id to add data to", required=True)
|
|
23
|
+
@click.option("-f", "--file", "_file", help="WellLog data file to add", required=True)
|
|
24
|
+
@handle_cli_exceptions
|
|
25
|
+
@command_with_output("recordIds")
|
|
26
|
+
def _click_command(state: State, _id: str, _file: str):
|
|
27
|
+
return add_data(state, _id, _file)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def add_data(state: State, identifier: str, data_file: str):
|
|
31
|
+
"""Well Log add data"""
|
|
32
|
+
client = CliOsduClient(state.config)
|
|
33
|
+
wellbore_client = client.get_wellbore_ddms_client(url_extra_path=WELLBORE_DDMS_WELL_LOG_PATH)
|
|
34
|
+
|
|
35
|
+
with open(data_file, 'rb') as file:
|
|
36
|
+
file_data = file.read()
|
|
37
|
+
|
|
38
|
+
response = wellbore_client.create_well_log_data(identifier, file_data)
|
|
39
|
+
client.check_status_code(response)
|
|
40
|
+
return response.json()
|
|
@@ -16,10 +16,11 @@ import click
|
|
|
16
16
|
|
|
17
17
|
from osducli.click_cli import CustomClickCommand, State, command_with_output
|
|
18
18
|
from osducli.cliclient import CliOsduClient, handle_cli_exceptions
|
|
19
|
+
from osducli.commands.wellbore_ddms._const import WELLBORE_DDMS_WELL_LOG_PATH
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
# click entry point
|
|
22
|
-
@click.command(cls=CustomClickCommand)
|
|
23
|
+
@click.command(cls=CustomClickCommand, help="Get Well Log data by id")
|
|
23
24
|
@click.option("-id", "--id", "_id", help="WellLog id to search for", required=True)
|
|
24
25
|
@click.option("-f", "--file", "_file", help="File to save WellLog data", required=True)
|
|
25
26
|
@handle_cli_exceptions
|
|
@@ -28,14 +29,14 @@ def _click_command(state: State, _id: str, _file: str):
|
|
|
28
29
|
return get_data(state, _id, _file)
|
|
29
30
|
|
|
30
31
|
|
|
31
|
-
def get_data(state: State, identifier: str,
|
|
32
|
+
def get_data(state: State, identifier: str, out_file: str):
|
|
32
33
|
"""Get Well Log record by id"""
|
|
33
34
|
client = CliOsduClient(state.config)
|
|
34
|
-
wellbore_client = client.get_wellbore_ddms_client(url_extra_path=
|
|
35
|
+
wellbore_client = client.get_wellbore_ddms_client(url_extra_path=WELLBORE_DDMS_WELL_LOG_PATH)
|
|
35
36
|
response = wellbore_client.get_well_log_data(identifier)
|
|
36
37
|
client.check_status_code(response)
|
|
37
38
|
|
|
38
|
-
with open(
|
|
39
|
+
with open(out_file, 'wb') as file:
|
|
39
40
|
file.write(response.content)
|
|
40
41
|
|
|
41
42
|
filename = os.path.abspath(file.name)
|
|
@@ -14,10 +14,11 @@ import click
|
|
|
14
14
|
|
|
15
15
|
from osducli.click_cli import CustomClickCommand, State, command_with_output
|
|
16
16
|
from osducli.cliclient import CliOsduClient, handle_cli_exceptions
|
|
17
|
+
from osducli.commands.wellbore_ddms._const import WELLBORE_DDMS_WELL_LOG_PATH
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
# click entry point
|
|
20
|
-
@click.command(cls=CustomClickCommand)
|
|
21
|
+
@click.command(cls=CustomClickCommand, help="Get Well Log record by id")
|
|
21
22
|
@click.option("-id", "--id", "_id", help="WellLog id to search for", required=True)
|
|
22
23
|
@handle_cli_exceptions
|
|
23
24
|
@command_with_output()
|
|
@@ -28,7 +29,7 @@ def _click_command(state: State, _id: str):
|
|
|
28
29
|
def get_record(state: State, identifier: str):
|
|
29
30
|
"""Get Well Log record by id"""
|
|
30
31
|
client = CliOsduClient(state.config)
|
|
31
|
-
wellbore_client = client.get_wellbore_ddms_client(url_extra_path=
|
|
32
|
+
wellbore_client = client.get_wellbore_ddms_client(url_extra_path=WELLBORE_DDMS_WELL_LOG_PATH)
|
|
32
33
|
response = wellbore_client.get_well_log(identifier)
|
|
33
34
|
client.check_status_code(response)
|
|
34
35
|
return response.json()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: osducli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.45
|
|
4
4
|
Summary: OSDU command line
|
|
5
5
|
Author-email: Equinor ASA <mhew@equinor.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -17,7 +17,7 @@ Description-Content-Type: text/x-rst
|
|
|
17
17
|
License-File: LICENSE.md
|
|
18
18
|
Requires-Dist: click
|
|
19
19
|
Requires-Dist: jmespath
|
|
20
|
-
Requires-Dist: osdu-api[all]==0.28
|
|
20
|
+
Requires-Dist: osdu-api[all]==0.28
|
|
21
21
|
Requires-Dist: requests
|
|
22
22
|
Requires-Dist: tabulate
|
|
23
23
|
Requires-Dist: packaging
|
|
@@ -33,8 +33,6 @@ Requires-Dist: google-cloud-storage
|
|
|
33
33
|
Provides-Extra: dev
|
|
34
34
|
Requires-Dist: black; extra == "dev"
|
|
35
35
|
Requires-Dist: isort; extra == "dev"
|
|
36
|
-
Requires-Dist: flake8; extra == "dev"
|
|
37
|
-
Requires-Dist: pep8; extra == "dev"
|
|
38
36
|
Requires-Dist: pylint; extra == "dev"
|
|
39
37
|
Requires-Dist: ruff; extra == "dev"
|
|
40
38
|
Requires-Dist: pytest; extra == "dev"
|
|
@@ -83,6 +81,11 @@ For more information, specify the `-h` flag:
|
|
|
83
81
|
Change Log
|
|
84
82
|
==========
|
|
85
83
|
|
|
84
|
+
0.0.45
|
|
85
|
+
------
|
|
86
|
+
|
|
87
|
+
- Fix msal_non_interactive authentication
|
|
88
|
+
|
|
86
89
|
0.0.44
|
|
87
90
|
------
|
|
88
91
|
|
|
@@ -98,8 +98,11 @@ src/osducli/commands/wellbore_ddms/__init__.py
|
|
|
98
98
|
src/osducli/commands/wellbore_ddms/_const.py
|
|
99
99
|
src/osducli/commands/wellbore_ddms/info.py
|
|
100
100
|
src/osducli/commands/wellbore_ddms/well_log/__init__.py
|
|
101
|
-
src/osducli/commands/wellbore_ddms/well_log/
|
|
102
|
-
src/osducli/commands/wellbore_ddms/well_log/
|
|
101
|
+
src/osducli/commands/wellbore_ddms/well_log/add.py
|
|
102
|
+
src/osducli/commands/wellbore_ddms/well_log/get.py
|
|
103
|
+
src/osducli/commands/wellbore_ddms/well_log/data/__init__.py
|
|
104
|
+
src/osducli/commands/wellbore_ddms/well_log/data/add.py
|
|
105
|
+
src/osducli/commands/wellbore_ddms/well_log/data/get.py
|
|
103
106
|
src/osducli/commands/workflow/__init__.py
|
|
104
107
|
src/osducli/commands/workflow/_const.py
|
|
105
108
|
src/osducli/commands/workflow/get.py
|
|
@@ -92,11 +92,11 @@ def _validate_output_read_line(
|
|
|
92
92
|
subgroups_index += 1
|
|
93
93
|
|
|
94
94
|
else:
|
|
95
|
-
|
|
95
|
+
raise AssertionError(f"Found unknown command {first_word_of_line}.")
|
|
96
96
|
|
|
97
97
|
return subgroups_index, commands_index
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
raise AssertionError(f"Section name {section} is not supported")
|
|
100
100
|
# The following line will be reached. It is added so pylint does not complain
|
|
101
101
|
# about inconsistent-return-statements.
|
|
102
102
|
return subgroups_index, commands_index
|
|
@@ -194,7 +194,7 @@ def validate_output(
|
|
|
194
194
|
assert b"" == err, "ERROR: in command: " + help_command
|
|
195
195
|
|
|
196
196
|
if not returned_string:
|
|
197
|
-
|
|
197
|
+
raise AssertionError("No help text in command: " + help_command)
|
|
198
198
|
|
|
199
199
|
returned_string = returned_string.decode("utf-8")
|
|
200
200
|
lines = returned_string.splitlines()
|
|
@@ -260,9 +260,9 @@ def validate_output(
|
|
|
260
260
|
|
|
261
261
|
except BaseException as exception: # pylint: disable=broad-except
|
|
262
262
|
if not err:
|
|
263
|
-
|
|
263
|
+
raise AssertionError(f"ERROR: Command {help_command} returned error at execution. Output: {returned_string} Error: {str(exception)}") from exception
|
|
264
264
|
else:
|
|
265
|
-
|
|
265
|
+
raise AssertionError(f"ERROR: Command {help_command} returned error at execution. Output: {returned_string} Error: {err}") from err
|
|
266
266
|
|
|
267
267
|
|
|
268
268
|
|
|
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
|
|
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
|
|
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
|
|
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
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
"""Test cases for CliOsduClient"""
|
|
14
14
|
|
|
15
|
+
import json
|
|
15
16
|
from unittest.mock import MagicMock, Mock
|
|
16
17
|
|
|
17
18
|
import pytest
|
|
18
|
-
import json
|
|
19
19
|
from osdu_api.clients.base_client import BaseClient
|
|
20
20
|
from osdu_api.model.http_method import HttpMethod
|
|
21
21
|
|