osducli 0.0.45__py3-none-any.whl → 0.0.47__py3-none-any.whl

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/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.47
osducli/__init__.py CHANGED
@@ -11,5 +11,3 @@
11
11
  # limitations under the License.
12
12
 
13
13
  """ OSDU command line environment"""
14
-
15
- __VERSION__ = "0.0.45"
osducli/click_cli.py CHANGED
@@ -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()
osducli/cliclient.py CHANGED
@@ -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:
osducli/version.py ADDED
@@ -0,0 +1,18 @@
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
+ import os
13
+
14
+
15
+ def get_version():
16
+ version_file = os.path.join(os.path.dirname(__file__), "VERSION")
17
+ with open(version_file) as fh:
18
+ return fh.read().strip()
@@ -1,15 +1,14 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: osducli
3
- Version: 0.0.45
3
+ Version: 0.0.47
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
@@ -17,7 +16,7 @@ Description-Content-Type: text/x-rst
17
16
  License-File: LICENSE.md
18
17
  Requires-Dist: click
19
18
  Requires-Dist: jmespath
20
- Requires-Dist: osdu-api[all]==0.28
19
+ Requires-Dist: osdu-api[common]==1.0.3
21
20
  Requires-Dist: requests
22
21
  Requires-Dist: tabulate
23
22
  Requires-Dist: packaging
@@ -43,13 +42,14 @@ Requires-Dist: testfixtures; extra == "dev"
43
42
  Requires-Dist: setuptools; extra == "dev"
44
43
  Requires-Dist: tox; extra == "dev"
45
44
  Requires-Dist: docutils; extra == "dev"
45
+ Dynamic: license-file
46
46
 
47
47
  OSDU Command Line Interface
48
48
  ===========================
49
49
 
50
50
  Command-line interface for interacting with OSDU.
51
51
 
52
- 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:
52
+ 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:
53
53
 
54
54
  .. code-block:: bash
55
55
 
@@ -81,6 +81,11 @@ For more information, specify the `-h` flag:
81
81
  Change Log
82
82
  ==========
83
83
 
84
+ 0.0.46
85
+ ------
86
+ - Simpler install command without extra-index-url
87
+ - Fix error handling to get correct message details
88
+
84
89
  0.0.45
85
90
  ------
86
91
 
@@ -1,10 +1,12 @@
1
- osducli/__init__.py,sha256=wchj1xeJep01vDg-LwBaAJ8nEesYQ8UP6klHacXfTaY,615
1
+ osducli/VERSION,sha256=asCQlwEYNNa-OaZ02iRHVxP3qlng92XLRtgATrJAaTY,6
2
+ osducli/__init__.py,sha256=J3RwqAbN7MWvz8vL24fMUar9Sfk8nMI8xq_aSHGXUy8,591
2
3
  osducli/__main__.py,sha256=4HonhahSaS3Un0f93qnbs_pmJ5pbbVHU-qdhsssVkB0,3661
3
- osducli/click_cli.py,sha256=7lpYqufxRSMrNZM9M-VANOYKwP0wo-1oxt2eSVHSW_M,10845
4
- osducli/cliclient.py,sha256=sUQyIiomrf-WIcFn9C6UjISvHANLjijI-SVLxQ3T2MY,13242
4
+ osducli/click_cli.py,sha256=EIe42DOnHDRKU3mPGwT12jI-yX3hsBOp_nS4nMTWc_Y,10864
5
+ osducli/cliclient.py,sha256=u1pF5wYK1OmboGQld6cLsVXsSr0Fau000dZjvsW-yK0,13872
5
6
  osducli/config.py,sha256=lSDxp15JiJQ_J_YjdvI1q243uexzxZpXSYMsSgQIgdQ,7802
6
7
  osducli/log.py,sha256=a5pzV2QIOqFEWCGFj01FaZk9PEzMkAr6duHei_dCme8,1549
7
8
  osducli/state.py,sha256=b0GHH2oZ-4ogtmHenNkYwNRSE3OpSTL0XklbKVjUAKQ,3335
9
+ osducli/version.py,sha256=I8tEetbJZtyhZvVgLMOKwbOnBCKYEfpQlT0YcTP3nXc,722
8
10
  osducli/wbddms_client.py,sha256=ANzhNCQ7TkM2OiPy18w4bJgL8CmveteUXsiDjlQyNTw,2686
9
11
  osducli/auth/__init__.py,sha256=p2bZquIGOPfofHV6GIzWRUv_b9O_pIH5BTyv_gfQT6c,553
10
12
  osducli/auth/aws_token_credential.py,sha256=awKDU2nA3iGXYdIR1NTBk6z64ImIC7okfYr8x7FOM-s,2322
@@ -74,7 +76,7 @@ osducli/commands/status/status.py,sha256=yh6KVUpNYbrLJIH-7GjMyo2MpR8Wvycr4KdkxUI
74
76
  osducli/commands/storage/__init__.py,sha256=Ilc97Kje3VVLZIBJucd_2jsW1GF5En00xF-A6kiLAFM,585
75
77
  osducli/commands/storage/_const.py,sha256=a7oIWewDVdgbE1bHcg8QTQDppVT48pgP1Yl-l8tCRhs,847
76
78
  osducli/commands/storage/add.py,sha256=nDKP0490dU18Dtpaun3rluaCguJqtAFAxkS1P7WtG2Q,3386
77
- osducli/commands/storage/delete.py,sha256=ElhE5fdC1yybG7BsVY9Li0x8TG1WeQpkraWWLCB_wR0,1612
79
+ osducli/commands/storage/delete.py,sha256=ryjrd24wiJlTAL6jIsTW1gCxB0icAMu0YIyUTx578h0,1613
78
80
  osducli/commands/storage/get.py,sha256=FgjoN_1cY90cbU1osh53XviGvTZaPtRjthUmtP2Y2-k,2136
79
81
  osducli/commands/storage/info.py,sha256=CGbA92GJYkWcLXHx1Z4i9g7Auk-ws2Cg6n6X7_m27iw,1345
80
82
  osducli/commands/storage/list.py,sha256=bIN76XW70Xml0CCldNvjN-qCumqICjZkQPXs7LTY69M,1413
@@ -84,7 +86,7 @@ osducli/commands/unit/_const.py,sha256=GuBlXzsI723OKlqcBzsG21T44V_SbOPqdbaw8_c2c
84
86
  osducli/commands/unit/info.py,sha256=3mAB14C5256cDQGR_pUbSpKXN-0ohA7gxqxwq4t4VP8,1210
85
87
  osducli/commands/unit/list.py,sha256=-5yEk0RHNZudeaaRzzCQexUHR6kCYAzM60YaO0EujVI,1288
86
88
  osducli/commands/version/__init__.py,sha256=S8QUNV3WSGTJAWwzvPokDscvBP4m0BAwXV_JhSA0kD0,580
87
- osducli/commands/version/version.py,sha256=a_mpirlH5obnRhjUp9Ha4701Zj2rrU_NGQpQXRafHPY,4227
89
+ osducli/commands/version/version.py,sha256=5Yc2e0IDlFJtbZvGWVSXFHBWtBO48K60KRZmpLGDjg4,4246
88
90
  osducli/commands/wellbore_ddms/__init__.py,sha256=AvXe60cTMl2ptWH6-wjaODGpzOiQazUJ05yrBkSlXYo,583
89
91
  osducli/commands/wellbore_ddms/_const.py,sha256=XP4Cc19vBVG88N5qXDvPFhJEtSD4vKw05lnEwDTKRqM,1084
90
92
  osducli/commands/wellbore_ddms/info.py,sha256=Jeyt0uFpyWBKY9jAZK1AJUXiwgPhm0cPyagfwmRYFYQ,1417
@@ -109,9 +111,9 @@ osducli/util/file.py,sha256=kfh6SLOI7X54gZ0hWF3kQ1npXPylNYgE1d1_w-fFyr0,1821
109
111
  osducli/util/prompt.py,sha256=0i3eNnxOHRQstvsvfiKnN0lIxXu6sEXIcU8txeYRhNs,7492
110
112
  osducli/util/pypi.py,sha256=-DW5CThkKKiOwLp2tg85BmrLKZzkMI9pu8DyWNPZH6E,1192
111
113
  osducli/util/service_info.py,sha256=YsVvoRoeG1osFjql2AgVkGoj1TePuhBZf3CQXl2a9As,2577
112
- osducli-0.0.45.dist-info/LICENSE.md,sha256=9xnGPjJkOAgd0kH4QLlvOIYKqY1M49gWUQpoUxAU-9Y,12788
113
- osducli-0.0.45.dist-info/METADATA,sha256=duWD8sZg9w2B5bFsyARb37TdLRJVOJQOAhyRN4q4Lr4,6167
114
- osducli-0.0.45.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
115
- osducli-0.0.45.dist-info/entry_points.txt,sha256=gASIcihV0BSJDZOUK-zTzb8RiccZCvKfVZMna9RsEIg,47
116
- osducli-0.0.45.dist-info/top_level.txt,sha256=lqiP5fuyH8lx7c2emYoIVZNxZAPX-bSwnMH789wxUAY,8
117
- osducli-0.0.45.dist-info/RECORD,,
114
+ osducli-0.0.47.dist-info/licenses/LICENSE.md,sha256=9xnGPjJkOAgd0kH4QLlvOIYKqY1M49gWUQpoUxAU-9Y,12788
115
+ osducli-0.0.47.dist-info/METADATA,sha256=sTxEF-cj6Hgtr6Oh0lZR2tdhE_WfRynUNylqt_HjE00,6260
116
+ osducli-0.0.47.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
117
+ osducli-0.0.47.dist-info/entry_points.txt,sha256=gASIcihV0BSJDZOUK-zTzb8RiccZCvKfVZMna9RsEIg,47
118
+ osducli-0.0.47.dist-info/top_level.txt,sha256=lqiP5fuyH8lx7c2emYoIVZNxZAPX-bSwnMH789wxUAY,8
119
+ osducli-0.0.47.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.2)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5