osducli 0.0.44__tar.gz → 0.0.46__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 (128) hide show
  1. osducli-0.0.46/MANIFEST.in +1 -0
  2. {osducli-0.0.44/src/osducli.egg-info → osducli-0.0.46}/PKG-INFO +15 -9
  3. {osducli-0.0.44 → osducli-0.0.46}/README.rst +11 -1
  4. osducli-0.0.46/VERSION +1 -0
  5. {osducli-0.0.44 → osducli-0.0.46}/pyproject.toml +19 -13
  6. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/__init__.py +0 -2
  7. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/auth/credentials.py +0 -3
  8. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/auth/msal_non_interactive.py +13 -20
  9. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/click_cli.py +2 -2
  10. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/cliclient.py +19 -5
  11. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/storage/delete.py +1 -1
  12. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/version/version.py +2 -2
  13. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/wellbore_ddms/_const.py +1 -0
  14. osducli-0.0.46/src/osducli/commands/wellbore_ddms/well_log/add.py +42 -0
  15. osducli-0.0.46/src/osducli/commands/wellbore_ddms/well_log/data/__init__.py +13 -0
  16. osducli-0.0.46/src/osducli/commands/wellbore_ddms/well_log/data/add.py +40 -0
  17. osducli-0.0.44/src/osducli/commands/wellbore_ddms/well_log/data.py → osducli-0.0.46/src/osducli/commands/wellbore_ddms/well_log/data/get.py +5 -4
  18. osducli-0.0.44/src/osducli/commands/wellbore_ddms/well_log/record.py → osducli-0.0.46/src/osducli/commands/wellbore_ddms/well_log/get.py +3 -2
  19. osducli-0.0.46/src/osducli/version.py +16 -0
  20. {osducli-0.0.44 → osducli-0.0.46/src/osducli.egg-info}/PKG-INFO +15 -9
  21. {osducli-0.0.44 → osducli-0.0.46}/src/osducli.egg-info/SOURCES.txt +8 -3
  22. {osducli-0.0.44 → osducli-0.0.46}/src/osducli.egg-info/requires.txt +1 -3
  23. {osducli-0.0.44 → osducli-0.0.46}/tests/test_help_text.py +5 -5
  24. osducli-0.0.44/LICENSE.md +0 -231
  25. {osducli-0.0.44 → osducli-0.0.46}/setup.cfg +0 -0
  26. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/__main__.py +0 -0
  27. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/auth/__init__.py +0 -0
  28. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/auth/aws_token_credential.py +0 -0
  29. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/auth/msal_interactive.py +0 -0
  30. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/auth/token_credential.py +0 -0
  31. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/__init__.py +0 -0
  32. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/config/__init__.py +0 -0
  33. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/config/consts.py +0 -0
  34. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/config/default.py +0 -0
  35. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/config/info.py +0 -0
  36. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/config/list.py +0 -0
  37. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/config/update.py +0 -0
  38. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/crs/__init__.py +0 -0
  39. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/crs/_const.py +0 -0
  40. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/crs/areas.py +0 -0
  41. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/crs/info.py +0 -0
  42. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/crs/list.py +0 -0
  43. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/crs/summary.py +0 -0
  44. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/crs/transforms.py +0 -0
  45. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/dataload/__init__.py +0 -0
  46. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/dataload/checkrefs.py +0 -0
  47. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/dataload/ingest.py +0 -0
  48. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/dataload/status.py +0 -0
  49. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/dataload/verify.py +0 -0
  50. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/entitlements/__init__.py +0 -0
  51. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/entitlements/_const.py +0 -0
  52. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/entitlements/groups/__init__.py +0 -0
  53. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/entitlements/groups/add.py +0 -0
  54. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/entitlements/groups/delete.py +0 -0
  55. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/entitlements/groups/members.py +0 -0
  56. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/entitlements/info.py +0 -0
  57. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/entitlements/members/__init__.py +0 -0
  58. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/entitlements/members/add.py +0 -0
  59. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/entitlements/members/groups.py +0 -0
  60. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/entitlements/members/list.py +0 -0
  61. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/entitlements/members/remove.py +0 -0
  62. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/entitlements/mygroups.py +0 -0
  63. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/file/__init__.py +0 -0
  64. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/file/_const.py +0 -0
  65. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/file/download.py +0 -0
  66. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/file/info.py +0 -0
  67. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/file/metadata.py +0 -0
  68. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/legal/__init__.py +0 -0
  69. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/legal/_const.py +0 -0
  70. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/legal/add.py +0 -0
  71. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/legal/delete.py +0 -0
  72. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/legal/info.py +0 -0
  73. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/legal/listtags.py +0 -0
  74. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/list/__init__.py +0 -0
  75. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/list/records.py +0 -0
  76. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/schema/__init__.py +0 -0
  77. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/schema/_const.py +0 -0
  78. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/schema/add.py +0 -0
  79. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/schema/get.py +0 -0
  80. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/schema/info.py +0 -0
  81. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/schema/list.py +0 -0
  82. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/search/__init__.py +0 -0
  83. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/search/_const.py +0 -0
  84. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/search/id.py +0 -0
  85. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/search/info.py +0 -0
  86. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/search/kind.py +0 -0
  87. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/search/query.py +0 -0
  88. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/status/__init__.py +0 -0
  89. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/status/status.py +0 -0
  90. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/storage/__init__.py +0 -0
  91. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/storage/_const.py +0 -0
  92. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/storage/add.py +0 -0
  93. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/storage/get.py +0 -0
  94. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/storage/info.py +0 -0
  95. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/storage/list.py +0 -0
  96. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/storage/versions.py +0 -0
  97. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/unit/__init__.py +0 -0
  98. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/unit/_const.py +0 -0
  99. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/unit/info.py +0 -0
  100. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/unit/list.py +0 -0
  101. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/version/__init__.py +0 -0
  102. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/wellbore_ddms/__init__.py +0 -0
  103. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/wellbore_ddms/info.py +0 -0
  104. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/wellbore_ddms/well_log/__init__.py +0 -0
  105. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/workflow/__init__.py +0 -0
  106. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/workflow/_const.py +0 -0
  107. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/workflow/get.py +0 -0
  108. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/workflow/info.py +0 -0
  109. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/workflow/list.py +0 -0
  110. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/workflow/register.py +0 -0
  111. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/workflow/runs.py +0 -0
  112. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/workflow/status.py +0 -0
  113. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/commands/workflow/unregister.py +0 -0
  114. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/config.py +0 -0
  115. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/log.py +0 -0
  116. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/state.py +0 -0
  117. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/util/__init__.py +0 -0
  118. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/util/exceptions.py +0 -0
  119. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/util/file.py +1 -1
  120. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/util/prompt.py +0 -0
  121. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/util/pypi.py +0 -0
  122. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/util/service_info.py +0 -0
  123. {osducli-0.0.44 → osducli-0.0.46}/src/osducli/wbddms_client.py +0 -0
  124. {osducli-0.0.44 → osducli-0.0.46}/src/osducli.egg-info/dependency_links.txt +0 -0
  125. {osducli-0.0.44 → osducli-0.0.46}/src/osducli.egg-info/entry_points.txt +0 -0
  126. {osducli-0.0.44 → osducli-0.0.46}/src/osducli.egg-info/top_level.txt +0 -0
  127. {osducli-0.0.44 → osducli-0.0.46}/tests/test_click_cli_state.py +0 -0
  128. {osducli-0.0.44 → osducli-0.0.46}/tests/test_cliclient.py +1 -1
@@ -0,0 +1 @@
1
+ include VERSION
@@ -1,23 +1,21 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: osducli
3
- Version: 0.0.44
3
+ Version: 0.0.46
4
4
  Summary: OSDU command line
5
5
  Author-email: Equinor ASA <mhew@equinor.com>
6
- License: Apache-2.0
6
+ License-Expression: Apache-2.0
7
7
  Project-URL: homepage, https://community.opengroup.org/osdu/platform/data-flow/data-loading/osdu-cli
8
8
  Project-URL: issue-tracker, https://community.opengroup.org/osdu/platform/data-flow/data-loading/osdu-cli/-/issues
9
9
  Keywords: osdu
10
10
  Classifier: Development Status :: 3 - Alpha
11
11
  Classifier: Environment :: Console
12
- Classifier: License :: OSI Approved :: Apache Software License
13
12
  Classifier: Natural Language :: English
14
13
  Classifier: Programming Language :: Python :: 3.13
15
14
  Requires-Python: >=3.12
16
15
  Description-Content-Type: text/x-rst
17
- License-File: LICENSE.md
18
16
  Requires-Dist: click
19
17
  Requires-Dist: jmespath
20
- Requires-Dist: osdu-api[all]==0.28.0rc949
18
+ Requires-Dist: osdu-api[common]==1.0.3
21
19
  Requires-Dist: requests
22
20
  Requires-Dist: tabulate
23
21
  Requires-Dist: packaging
@@ -33,8 +31,6 @@ Requires-Dist: google-cloud-storage
33
31
  Provides-Extra: dev
34
32
  Requires-Dist: black; extra == "dev"
35
33
  Requires-Dist: isort; extra == "dev"
36
- Requires-Dist: flake8; extra == "dev"
37
- Requires-Dist: pep8; extra == "dev"
38
34
  Requires-Dist: pylint; extra == "dev"
39
35
  Requires-Dist: ruff; extra == "dev"
40
36
  Requires-Dist: pytest; extra == "dev"
@@ -51,7 +47,7 @@ OSDU Command Line Interface
51
47
 
52
48
  Command-line interface for interacting with OSDU.
53
49
 
54
- NOTE: With version 0.0.41 and later the pip install command may need extra parameter since a dependency is not available from pypi.org:
50
+ NOTE: With version 0.0.45 and earlier the pip install command may need extra parameter since a dependency is not available from pypi.org:
55
51
 
56
52
  .. code-block:: bash
57
53
 
@@ -83,6 +79,16 @@ For more information, specify the `-h` flag:
83
79
  Change Log
84
80
  ==========
85
81
 
82
+ 0.0.46
83
+ ------
84
+ - Simpler install command without extra-index-url
85
+ - Fix error handling to get correct message details
86
+
87
+ 0.0.45
88
+ ------
89
+
90
+ - Fix msal_non_interactive authentication
91
+
86
92
  0.0.44
87
93
  ------
88
94
 
@@ -3,7 +3,7 @@ OSDU Command Line Interface
3
3
 
4
4
  Command-line interface for interacting with OSDU.
5
5
 
6
- NOTE: With version 0.0.41 and later the pip install command may need extra parameter since a dependency is not available from pypi.org:
6
+ NOTE: With version 0.0.45 and earlier the pip install command may need extra parameter since a dependency is not available from pypi.org:
7
7
 
8
8
  .. code-block:: bash
9
9
 
@@ -35,6 +35,16 @@ For more information, specify the `-h` flag:
35
35
  Change Log
36
36
  ==========
37
37
 
38
+ 0.0.46
39
+ ------
40
+ - Simpler install command without extra-index-url
41
+ - Fix error handling to get correct message details
42
+
43
+ 0.0.45
44
+ ------
45
+
46
+ - Fix msal_non_interactive authentication
47
+
38
48
  0.0.44
39
49
  ------
40
50
 
osducli-0.0.46/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.46
@@ -1,12 +1,12 @@
1
1
  [build-system]
2
- requires = ["setuptools>=61.0", "wheel"]
2
+ requires = ["setuptools>=80.4.0", "wheel"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "osducli"
7
7
  dynamic = ["version", "readme"]
8
8
  description = "OSDU command line"
9
- license = { text = "Apache-2.0" }
9
+ license = "Apache-2.0"
10
10
  requires-python = ">= 3.12"
11
11
 
12
12
  authors = [
@@ -16,7 +16,6 @@ authors = [
16
16
  classifiers = [
17
17
  "Development Status :: 3 - Alpha",
18
18
  "Environment :: Console",
19
- "License :: OSI Approved :: Apache Software License",
20
19
  "Natural Language :: English",
21
20
  "Programming Language :: Python :: 3.13",
22
21
  ]
@@ -26,7 +25,7 @@ keywords = ["osdu"]
26
25
  dependencies = [
27
26
  "click",
28
27
  "jmespath",
29
- "osdu-api[all]==0.28.0rc949",
28
+ "osdu-api[common]==1.0.3",
30
29
  "requests",
31
30
  "tabulate",
32
31
  "packaging",
@@ -54,8 +53,6 @@ dev = [
54
53
  "black",
55
54
  "isort",
56
55
  # linting
57
- "flake8",
58
- "pep8",
59
56
  "pylint",
60
57
  "ruff",
61
58
  # testing
@@ -73,14 +70,8 @@ dev = [
73
70
  [project.scripts]
74
71
  osdu = "osducli.__main__:main"
75
72
 
76
- [tool.setuptools.packages.find]
77
- where = ["src"]
78
-
79
- [tool.setuptools]
80
- py-modules = ["osducli"]
81
-
82
73
  [tool.setuptools.dynamic]
83
- version = {attr = "osducli.__VERSION__"}
74
+ version = {file = "VERSION"}
84
75
  readme = {file = "README.rst"}
85
76
 
86
77
  [tool.nose2]
@@ -93,3 +84,18 @@ src = ["src"]
93
84
  [tool.ruff.lint]
94
85
  select = ["E", "F", "W", "I", "B", "UP"]
95
86
  ignore = ["E501"]
87
+
88
+ [tool.pylint."messages control"]
89
+ disable = [
90
+ "missing-docstring",
91
+ "protected-access",
92
+ "too-many-arguments",
93
+ "too-many-locals",
94
+ "too-many-branches",
95
+ "too-many-positional-arguments",
96
+ "format",
97
+ "fixme",
98
+ "unknown-option-value",
99
+ "unspecified-encoding",
100
+ "broad-exception-raised"
101
+ ]
@@ -11,5 +11,3 @@
11
11
  # limitations under the License.
12
12
 
13
13
  """ OSDU command line environment"""
14
-
15
- __VERSION__ = "0.0.44"
@@ -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
- __access_token = None
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.__access_token
49
+ return self._access_token
49
50
 
50
- def refresh_token(self) -> str: # pylint: disable=inconsistent-return-statements
51
+ def refresh_token(self) -> str:
51
52
  """
52
53
  return access_token.
53
54
  """
54
- token = self._get_token()
55
- if 'access_token' in token:
56
- __access_token = token['access_token']
57
- return __access_token
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
- def _get_token(self) -> dict:
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
@@ -29,11 +29,11 @@ from jmespath import compile as compile_jmespath
29
29
  from packaging.version import Version
30
30
  from tabulate import tabulate
31
31
 
32
- import osducli
33
32
  from osducli.config import CLI_ENV_VAR_PREFIX, CLIConfig
34
33
  from osducli.log import get_logger
35
34
  from osducli.state import get_default_config, get_default_config_path
36
35
  from osducli.util.pypi import get_pypi_version
36
+ from osducli.version import get_version
37
37
 
38
38
 
39
39
  class State:
@@ -103,7 +103,7 @@ class CustomMainClickGroup(CustomClickGroup):
103
103
  - :meth:`format_epilog`
104
104
  """
105
105
  super().format_help(ctx, formatter)
106
- current_version = osducli.__VERSION__
106
+ current_version = get_version()
107
107
  latest_version = get_pypi_version("osducli")
108
108
  if latest_version is not None and Version(current_version) < Version(latest_version):
109
109
  formatter.write_paragraph()
@@ -77,11 +77,7 @@ def handle_cli_exceptions(function):
77
77
  except HTTPError as ex:
78
78
  logger.error(MSG_HTTP_ERROR)
79
79
  logger.error("Error (%s) - %s", ex.response.status_code, ex.response.reason)
80
- try:
81
- error_content = ex.response.json()
82
- logger.error("Message: %s", error_content.get("message"))
83
- except json.JSONDecodeError:
84
- logger.error("Response: %s", ex.response.content)
80
+ logger.error("Message: %s", get_error_message(ex.response))
85
81
  except CliError as ex:
86
82
  logger.error("Error %s", ex.message)
87
83
  except ValueError as ex:
@@ -93,6 +89,24 @@ def handle_cli_exceptions(function):
93
89
  )
94
90
  sys.exit(1)
95
91
 
92
+ def get_error_message(response: requests.Response) -> str:
93
+ try:
94
+ json_content = response.json()
95
+ if "error" in json_content:
96
+ error_data = json_content["error"]
97
+ if "message" in error_data:
98
+ return error_data["message"]
99
+ if ("errors" in error_data
100
+ and isinstance(error_data["errors"], list)
101
+ and error_data["errors"]):
102
+ first_error = error_data["errors"][0]
103
+ if "message" in first_error:
104
+ return first_error["message"]
105
+ # Fallback if the JSON structure doesn't match the expected pattern
106
+ return response.content
107
+ except json.JSONDecodeError:
108
+ return response.content
109
+
96
110
  return decorated
97
111
 
98
112
 
@@ -38,7 +38,7 @@ def delete(state: State, id: str): # pylint: disable=invalid-name,redefined-bui
38
38
  client = CliOsduClient(state.config)
39
39
  record_client = client.get_storage_record_client()
40
40
  # TODO: Fix bug in SDK for DELETE. Workaround is to give bearer_token
41
- response = record_client.delete_record(recordId=id, bearer_token=client.token_refresher.refresh_token())
41
+ response = record_client.delete_record(record_id=id, bearer_token=client.token_refresher.refresh_token())
42
42
  client.check_status_code(response, [200, 204])
43
43
 
44
44
  if state.is_user_friendly_mode():
@@ -19,7 +19,6 @@ import click
19
19
  from packaging.version import Version
20
20
  from requests.exceptions import RequestException
21
21
 
22
- import osducli
23
22
  from osducli.click_cli import CustomClickCommand, State, command_with_output
24
23
  from osducli.cliclient import CliOsduClient, handle_cli_exceptions
25
24
  from osducli.config import (
@@ -36,6 +35,7 @@ from osducli.config import (
36
35
  )
37
36
  from osducli.log import get_logger
38
37
  from osducli.util.pypi import get_pypi_version
38
+ from osducli.version import get_version
39
39
 
40
40
  logger = get_logger(__name__)
41
41
 
@@ -74,7 +74,7 @@ def get_api_info(connection: CliOsduClient, config_url_key: str, url_extra_path:
74
74
  def version(state: State):
75
75
  """Print version information to standard system out."""
76
76
  if state.is_user_friendly_mode():
77
- current_version = osducli.__VERSION__
77
+ current_version = get_version()
78
78
  latest_version = get_pypi_version("osducli")
79
79
  version_info = f"Installed OSDU Cli Version {current_version}\n"
80
80
  if latest_version is not None:
@@ -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, _file: 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="/ddms/v3/welllogs")
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(_file, 'wb') as file:
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="/ddms/v3/welllogs")
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()
@@ -0,0 +1,16 @@
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
+
14
+ def get_version():
15
+ with open("VERSION") as fh:
16
+ return fh.read().strip()
@@ -1,23 +1,21 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: osducli
3
- Version: 0.0.44
3
+ Version: 0.0.46
4
4
  Summary: OSDU command line
5
5
  Author-email: Equinor ASA <mhew@equinor.com>
6
- License: Apache-2.0
6
+ License-Expression: Apache-2.0
7
7
  Project-URL: homepage, https://community.opengroup.org/osdu/platform/data-flow/data-loading/osdu-cli
8
8
  Project-URL: issue-tracker, https://community.opengroup.org/osdu/platform/data-flow/data-loading/osdu-cli/-/issues
9
9
  Keywords: osdu
10
10
  Classifier: Development Status :: 3 - Alpha
11
11
  Classifier: Environment :: Console
12
- Classifier: License :: OSI Approved :: Apache Software License
13
12
  Classifier: Natural Language :: English
14
13
  Classifier: Programming Language :: Python :: 3.13
15
14
  Requires-Python: >=3.12
16
15
  Description-Content-Type: text/x-rst
17
- License-File: LICENSE.md
18
16
  Requires-Dist: click
19
17
  Requires-Dist: jmespath
20
- Requires-Dist: osdu-api[all]==0.28.0rc949
18
+ Requires-Dist: osdu-api[common]==1.0.3
21
19
  Requires-Dist: requests
22
20
  Requires-Dist: tabulate
23
21
  Requires-Dist: packaging
@@ -33,8 +31,6 @@ Requires-Dist: google-cloud-storage
33
31
  Provides-Extra: dev
34
32
  Requires-Dist: black; extra == "dev"
35
33
  Requires-Dist: isort; extra == "dev"
36
- Requires-Dist: flake8; extra == "dev"
37
- Requires-Dist: pep8; extra == "dev"
38
34
  Requires-Dist: pylint; extra == "dev"
39
35
  Requires-Dist: ruff; extra == "dev"
40
36
  Requires-Dist: pytest; extra == "dev"
@@ -51,7 +47,7 @@ OSDU Command Line Interface
51
47
 
52
48
  Command-line interface for interacting with OSDU.
53
49
 
54
- NOTE: With version 0.0.41 and later the pip install command may need extra parameter since a dependency is not available from pypi.org:
50
+ NOTE: With version 0.0.45 and earlier the pip install command may need extra parameter since a dependency is not available from pypi.org:
55
51
 
56
52
  .. code-block:: bash
57
53
 
@@ -83,6 +79,16 @@ For more information, specify the `-h` flag:
83
79
  Change Log
84
80
  ==========
85
81
 
82
+ 0.0.46
83
+ ------
84
+ - Simpler install command without extra-index-url
85
+ - Fix error handling to get correct message details
86
+
87
+ 0.0.45
88
+ ------
89
+
90
+ - Fix msal_non_interactive authentication
91
+
86
92
  0.0.44
87
93
  ------
88
94
 
@@ -1,5 +1,6 @@
1
- LICENSE.md
1
+ MANIFEST.in
2
2
  README.rst
3
+ VERSION
3
4
  pyproject.toml
4
5
  src/osducli/__init__.py
5
6
  src/osducli/__main__.py
@@ -8,6 +9,7 @@ src/osducli/cliclient.py
8
9
  src/osducli/config.py
9
10
  src/osducli/log.py
10
11
  src/osducli/state.py
12
+ src/osducli/version.py
11
13
  src/osducli/wbddms_client.py
12
14
  src/osducli.egg-info/PKG-INFO
13
15
  src/osducli.egg-info/SOURCES.txt
@@ -98,8 +100,11 @@ src/osducli/commands/wellbore_ddms/__init__.py
98
100
  src/osducli/commands/wellbore_ddms/_const.py
99
101
  src/osducli/commands/wellbore_ddms/info.py
100
102
  src/osducli/commands/wellbore_ddms/well_log/__init__.py
101
- src/osducli/commands/wellbore_ddms/well_log/data.py
102
- src/osducli/commands/wellbore_ddms/well_log/record.py
103
+ src/osducli/commands/wellbore_ddms/well_log/add.py
104
+ src/osducli/commands/wellbore_ddms/well_log/get.py
105
+ src/osducli/commands/wellbore_ddms/well_log/data/__init__.py
106
+ src/osducli/commands/wellbore_ddms/well_log/data/add.py
107
+ src/osducli/commands/wellbore_ddms/well_log/data/get.py
103
108
  src/osducli/commands/workflow/__init__.py
104
109
  src/osducli/commands/workflow/_const.py
105
110
  src/osducli/commands/workflow/get.py
@@ -1,6 +1,6 @@
1
1
  click
2
2
  jmespath
3
- osdu-api[all]==0.28.0rc949
3
+ osdu-api[common]==1.0.3
4
4
  requests
5
5
  tabulate
6
6
  packaging
@@ -17,8 +17,6 @@ google-cloud-storage
17
17
  [dev]
18
18
  black
19
19
  isort
20
- flake8
21
- pep8
22
20
  pylint
23
21
  ruff
24
22
  pytest