osducli 0.0.43__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.
Files changed (125) hide show
  1. {osducli-0.0.43/src/osducli.egg-info → osducli-0.0.45}/PKG-INFO +12 -4
  2. {osducli-0.0.43 → osducli-0.0.45}/README.rst +10 -0
  3. {osducli-0.0.43 → osducli-0.0.45}/pyproject.toml +16 -3
  4. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/__init__.py +1 -1
  5. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/auth/credentials.py +0 -3
  6. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/auth/msal_non_interactive.py +13 -20
  7. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/cliclient.py +33 -9
  8. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/wellbore_ddms/_const.py +1 -0
  9. osducli-0.0.45/src/osducli/commands/wellbore_ddms/well_log/add.py +42 -0
  10. osducli-0.0.45/src/osducli/commands/wellbore_ddms/well_log/data/__init__.py +13 -0
  11. osducli-0.0.45/src/osducli/commands/wellbore_ddms/well_log/data/add.py +40 -0
  12. osducli-0.0.43/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
  13. osducli-0.0.43/src/osducli/commands/wellbore_ddms/well_log/record.py → osducli-0.0.45/src/osducli/commands/wellbore_ddms/well_log/get.py +3 -2
  14. {osducli-0.0.43 → osducli-0.0.45/src/osducli.egg-info}/PKG-INFO +12 -4
  15. {osducli-0.0.43 → osducli-0.0.45}/src/osducli.egg-info/SOURCES.txt +5 -2
  16. {osducli-0.0.43 → osducli-0.0.45}/src/osducli.egg-info/requires.txt +1 -3
  17. {osducli-0.0.43 → osducli-0.0.45}/tests/test_cliclient.py +3 -0
  18. {osducli-0.0.43 → osducli-0.0.45}/tests/test_help_text.py +5 -5
  19. {osducli-0.0.43 → osducli-0.0.45}/LICENSE.md +0 -0
  20. {osducli-0.0.43 → osducli-0.0.45}/setup.cfg +0 -0
  21. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/__main__.py +0 -0
  22. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/auth/__init__.py +0 -0
  23. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/auth/aws_token_credential.py +0 -0
  24. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/auth/msal_interactive.py +0 -0
  25. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/auth/token_credential.py +0 -0
  26. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/click_cli.py +0 -0
  27. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/__init__.py +0 -0
  28. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/config/__init__.py +0 -0
  29. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/config/consts.py +0 -0
  30. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/config/default.py +0 -0
  31. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/config/info.py +0 -0
  32. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/config/list.py +0 -0
  33. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/config/update.py +0 -0
  34. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/crs/__init__.py +0 -0
  35. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/crs/_const.py +0 -0
  36. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/crs/areas.py +0 -0
  37. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/crs/info.py +0 -0
  38. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/crs/list.py +0 -0
  39. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/crs/summary.py +0 -0
  40. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/crs/transforms.py +0 -0
  41. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/dataload/__init__.py +0 -0
  42. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/dataload/checkrefs.py +0 -0
  43. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/dataload/ingest.py +0 -0
  44. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/dataload/status.py +0 -0
  45. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/dataload/verify.py +0 -0
  46. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/entitlements/__init__.py +0 -0
  47. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/entitlements/_const.py +0 -0
  48. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/entitlements/groups/__init__.py +0 -0
  49. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/entitlements/groups/add.py +0 -0
  50. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/entitlements/groups/delete.py +0 -0
  51. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/entitlements/groups/members.py +0 -0
  52. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/entitlements/info.py +0 -0
  53. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/entitlements/members/__init__.py +0 -0
  54. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/entitlements/members/add.py +0 -0
  55. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/entitlements/members/groups.py +0 -0
  56. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/entitlements/members/list.py +0 -0
  57. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/entitlements/members/remove.py +0 -0
  58. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/entitlements/mygroups.py +0 -0
  59. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/file/__init__.py +0 -0
  60. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/file/_const.py +0 -0
  61. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/file/download.py +0 -0
  62. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/file/info.py +0 -0
  63. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/file/metadata.py +0 -0
  64. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/legal/__init__.py +0 -0
  65. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/legal/_const.py +0 -0
  66. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/legal/add.py +0 -0
  67. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/legal/delete.py +0 -0
  68. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/legal/info.py +0 -0
  69. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/legal/listtags.py +0 -0
  70. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/list/__init__.py +0 -0
  71. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/list/records.py +0 -0
  72. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/schema/__init__.py +0 -0
  73. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/schema/_const.py +0 -0
  74. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/schema/add.py +0 -0
  75. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/schema/get.py +0 -0
  76. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/schema/info.py +0 -0
  77. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/schema/list.py +0 -0
  78. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/search/__init__.py +0 -0
  79. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/search/_const.py +0 -0
  80. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/search/id.py +0 -0
  81. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/search/info.py +0 -0
  82. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/search/kind.py +0 -0
  83. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/search/query.py +0 -0
  84. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/status/__init__.py +0 -0
  85. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/status/status.py +0 -0
  86. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/storage/__init__.py +0 -0
  87. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/storage/_const.py +0 -0
  88. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/storage/add.py +0 -0
  89. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/storage/delete.py +0 -0
  90. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/storage/get.py +0 -0
  91. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/storage/info.py +0 -0
  92. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/storage/list.py +0 -0
  93. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/storage/versions.py +0 -0
  94. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/unit/__init__.py +0 -0
  95. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/unit/_const.py +0 -0
  96. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/unit/info.py +0 -0
  97. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/unit/list.py +0 -0
  98. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/version/__init__.py +0 -0
  99. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/version/version.py +0 -0
  100. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/wellbore_ddms/__init__.py +0 -0
  101. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/wellbore_ddms/info.py +0 -0
  102. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/wellbore_ddms/well_log/__init__.py +0 -0
  103. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/workflow/__init__.py +0 -0
  104. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/workflow/_const.py +0 -0
  105. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/workflow/get.py +0 -0
  106. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/workflow/info.py +0 -0
  107. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/workflow/list.py +0 -0
  108. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/workflow/register.py +0 -0
  109. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/workflow/runs.py +0 -0
  110. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/workflow/status.py +0 -0
  111. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/commands/workflow/unregister.py +0 -0
  112. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/config.py +0 -0
  113. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/log.py +0 -0
  114. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/state.py +0 -0
  115. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/util/__init__.py +0 -0
  116. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/util/exceptions.py +0 -0
  117. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/util/file.py +1 -1
  118. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/util/prompt.py +0 -0
  119. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/util/pypi.py +0 -0
  120. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/util/service_info.py +0 -0
  121. {osducli-0.0.43 → osducli-0.0.45}/src/osducli/wbddms_client.py +0 -0
  122. {osducli-0.0.43 → osducli-0.0.45}/src/osducli.egg-info/dependency_links.txt +0 -0
  123. {osducli-0.0.43 → osducli-0.0.45}/src/osducli.egg-info/entry_points.txt +0 -0
  124. {osducli-0.0.43 → osducli-0.0.45}/src/osducli.egg-info/top_level.txt +0 -0
  125. {osducli-0.0.43 → osducli-0.0.45}/tests/test_click_cli_state.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: osducli
3
- Version: 0.0.43
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.0rc912
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,16 @@ 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
+
89
+ 0.0.44
90
+ ------
91
+
92
+ - Fix handling of json data in put and post requests
93
+
86
94
  0.0.43
87
95
  ------
88
96
 
@@ -35,6 +35,16 @@ For more information, specify the `-h` flag:
35
35
  Change Log
36
36
  ==========
37
37
 
38
+ 0.0.45
39
+ ------
40
+
41
+ - Fix msal_non_interactive authentication
42
+
43
+ 0.0.44
44
+ ------
45
+
46
+ - Fix handling of json data in put and post requests
47
+
38
48
  0.0.43
39
49
  ------
40
50
 
@@ -26,7 +26,7 @@ keywords = ["osdu"]
26
26
  dependencies = [
27
27
  "click",
28
28
  "jmespath",
29
- "osdu-api[all]==0.28.0rc912",
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
+ ]
@@ -12,4 +12,4 @@
12
12
 
13
13
  """ OSDU command line environment"""
14
14
 
15
- __VERSION__ = "0.0.43"
15
+ __VERSION__ = "0.0.45"
@@ -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
@@ -157,12 +157,14 @@ class CliOsduClient(BaseClient):
157
157
  return url
158
158
 
159
159
  def check_status_code(self, response: requests.Response, ok_status_codes: list = None):
160
+ """Check the status code of the response and raise an exception if not in the list of ok status codes"""
160
161
  if ok_status_codes is None:
161
162
  ok_status_codes = [200]
162
163
  if response.status_code not in ok_status_codes:
163
164
  raise HTTPError(response=response)
164
165
 
165
166
  def get_search_client(self) -> SearchClient:
167
+ """Get a client for the search service"""
166
168
  search_url = self.url_from_config(CONFIG_SEARCH_URL, "")
167
169
  if search_url.endswith("/"):
168
170
  search_url = search_url[:-1]
@@ -174,6 +176,7 @@ class CliOsduClient(BaseClient):
174
176
  )
175
177
 
176
178
  def get_storage_record_client(self) -> RecordClient:
179
+ """Get a client for the storage record service"""
177
180
  storage_url = self.url_from_config(CONFIG_STORAGE_URL, "")
178
181
  if storage_url.endswith("/"):
179
182
  storage_url = storage_url[:-1]
@@ -185,6 +188,7 @@ class CliOsduClient(BaseClient):
185
188
  )
186
189
 
187
190
  def get_entitlements_client(self) -> EntitlementsClient:
191
+ """Get a client for the entitlements service"""
188
192
  entitlements_url = self.url_from_config(CONFIG_ENTITLEMENTS_URL, "")
189
193
  if entitlements_url.endswith("/"):
190
194
  entitlements_url = entitlements_url[:-1]
@@ -195,7 +199,15 @@ class CliOsduClient(BaseClient):
195
199
  token_refresher=self.token_refresher
196
200
  )
197
201
 
198
- def get_wellbore_ddms_client(self, url_extra_path: str) -> WellboreDdmsClient:
202
+ def get_wellbore_ddms_client(
203
+ self,
204
+ url_extra_path: str
205
+ ) -> WellboreDdmsClient:
206
+ """Get a client for the wellbore ddms service
207
+
208
+ Args:
209
+ url_extra_path (str): extra path to add to the base path
210
+ """
199
211
  wellbore_ddms_url = self.url_from_config(CONFIG_WELLBORE_DDMS_URL, url_extra_path)
200
212
  return WellboreDdmsClient(
201
213
  wellbore_ddms_url=wellbore_ddms_url,
@@ -205,9 +217,12 @@ class CliOsduClient(BaseClient):
205
217
  )
206
218
 
207
219
  def cli_get(
208
- self, config_url_key: str, url_extra_path: str, ok_status_codes: list = None
220
+ self,
221
+ config_url_key: str,
222
+ url_extra_path: str,
223
+ ok_status_codes: list = None
209
224
  ) -> requests.Response:
210
- """[summary]
225
+ """Basic GET call to the given url, returning the response object.
211
226
 
212
227
  Args:
213
228
  config_url_key (str): key in configuration for the base path
@@ -220,9 +235,12 @@ class CliOsduClient(BaseClient):
220
235
  return response
221
236
 
222
237
  def cli_get_returning_json(
223
- self, config_url_key: str, url_extra_path: str, ok_status_codes: list = None
238
+ self,
239
+ config_url_key: str,
240
+ url_extra_path: str,
241
+ ok_status_codes: list = None
224
242
  ) -> dict:
225
- """[summary]
243
+ """Basic GET call to the given url, returning the json.
226
244
 
227
245
  Args:
228
246
  config_url_key (str): key in configuration for the base path
@@ -241,7 +259,7 @@ class CliOsduClient(BaseClient):
241
259
  data: str | dict,
242
260
  ok_status_codes: list = None,
243
261
  ) -> dict:
244
- """[summary]
262
+ """Basic POST call to the given url, returning the json.
245
263
 
246
264
  Args:
247
265
  config_url_key (str): key in configuration for the base path
@@ -253,6 +271,8 @@ class CliOsduClient(BaseClient):
253
271
  dict: returned json
254
272
  """
255
273
  url = self.url_from_config(config_url_key, url_extra_path)
274
+ if isinstance(data, dict):
275
+ data = json.dumps(data)
256
276
  response = self.make_request(method=HttpMethod.POST, url=url, data=data)
257
277
  self.check_status_code(response, ok_status_codes)
258
278
  return response.json()
@@ -263,7 +283,7 @@ class CliOsduClient(BaseClient):
263
283
  url_extra_path: str,
264
284
  ok_status_codes: list = None,
265
285
  ) -> requests.Response:
266
- """[summary]
286
+ """Basic DELETE call to the given url.
267
287
 
268
288
  Args:
269
289
  config_url_key (str): key in configuration for the base path
@@ -289,7 +309,7 @@ class CliOsduClient(BaseClient):
289
309
  data: str | dict,
290
310
  ok_status_codes: list = None,
291
311
  ) -> requests.Response:
292
- """[summary]
312
+ """Basic PUT call to the given url.
293
313
 
294
314
  Args:
295
315
  config_url_key (str): key in configuration for the base path
@@ -298,6 +318,8 @@ class CliOsduClient(BaseClient):
298
318
  ok_status_codes (list, optional): Optional status codes to check for successful call.
299
319
  """
300
320
  url = self.url_from_config(config_url_key, url_extra_path)
321
+ if isinstance(data, dict):
322
+ data = json.dumps(data)
301
323
  response = self.make_request(method=HttpMethod.PUT, url=url, data=data)
302
324
  self.check_status_code(response, ok_status_codes)
303
325
  return response
@@ -309,7 +331,7 @@ class CliOsduClient(BaseClient):
309
331
  data: str | dict,
310
332
  ok_status_codes: list = None,
311
333
  ) -> dict:
312
- """PUT the data to the given url.
334
+ """Basic PUT call to the given url, returning the json.
313
335
 
314
336
  Args:
315
337
  config_url_key (str): key in configuration for the base path
@@ -321,6 +343,8 @@ class CliOsduClient(BaseClient):
321
343
  dict: returned json
322
344
  """
323
345
  url = self.url_from_config(config_url_key, url_extra_path)
346
+ if isinstance(data, dict):
347
+ data = json.dumps(data)
324
348
  response = self.make_request(method=HttpMethod.PUT, url=url, data=data)
325
349
  self.check_status_code(response, ok_status_codes)
326
350
  return response.json()
@@ -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()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: osducli
3
- Version: 0.0.43
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.0rc912
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,16 @@ 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
+
89
+ 0.0.44
90
+ ------
91
+
92
+ - Fix handling of json data in put and post requests
93
+
86
94
  0.0.43
87
95
  ------
88
96
 
@@ -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/data.py
102
- src/osducli/commands/wellbore_ddms/well_log/record.py
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
@@ -1,6 +1,6 @@
1
1
  click
2
2
  jmespath
3
- osdu-api[all]==0.28.0rc912
3
+ osdu-api[all]==0.28
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
@@ -12,6 +12,7 @@
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
@@ -159,6 +160,8 @@ def test_cli_put(mocker, cli_client, config, path, data):
159
160
  response = cli_client.cli_put(config, path, data)
160
161
 
161
162
  mock_put.assert_called_once()
163
+ if isinstance(data, dict):
164
+ data = json.dumps(data)
162
165
  mock_put.assert_called_with(method=HttpMethod.PUT, url="https://dummy.com/core_" + config + path, data=data)
163
166
  assert response_mock == response
164
167
 
@@ -92,11 +92,11 @@ def _validate_output_read_line(
92
92
  subgroups_index += 1
93
93
 
94
94
  else:
95
- assert False, f"Found unknown command {first_word_of_line}."
95
+ raise AssertionError(f"Found unknown command {first_word_of_line}.")
96
96
 
97
97
  return subgroups_index, commands_index
98
98
 
99
- assert False, f"Section name {section} is not supported"
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
- assert False, "No help text in command: " + help_command
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
- assert False, f"ERROR: Command {help_command} returned error at execution. Output: {returned_string} Error: {str(exception)}"
263
+ raise AssertionError(f"ERROR: Command {help_command} returned error at execution. Output: {returned_string} Error: {str(exception)}") from exception
264
264
  else:
265
- assert False, f"ERROR: Command {help_command} returned error at execution. Output: {returned_string} Error: {err}"
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
@@ -11,8 +11,8 @@
11
11
  # limitations under the License.
12
12
 
13
13
  import errno
14
- import os
15
14
  import glob
15
+ import os
16
16
 
17
17
 
18
18
  def get_files_from_path(path: str) -> list: