osducli 0.0.43__py3-none-any.whl → 0.0.44__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/__init__.py CHANGED
@@ -12,4 +12,4 @@
12
12
 
13
13
  """ OSDU command line environment"""
14
14
 
15
- __VERSION__ = "0.0.43"
15
+ __VERSION__ = "0.0.44"
osducli/cliclient.py CHANGED
@@ -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()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: osducli
3
- Version: 0.0.43
3
+ Version: 0.0.44
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.0rc949
21
21
  Requires-Dist: requests
22
22
  Requires-Dist: tabulate
23
23
  Requires-Dist: packaging
@@ -83,6 +83,11 @@ For more information, specify the `-h` flag:
83
83
  Change Log
84
84
  ==========
85
85
 
86
+ 0.0.44
87
+ ------
88
+
89
+ - Fix handling of json data in put and post requests
90
+
86
91
  0.0.43
87
92
  ------
88
93
 
@@ -1,7 +1,7 @@
1
- osducli/__init__.py,sha256=LCBpMEnPLFYG7-Hsfhsl_HyDVEQPDKAJJLRCU2EiSkA,615
1
+ osducli/__init__.py,sha256=ibjJ0fg460aSRsjskiE_LSNoQ5I7qcPYsI5C1Z7MFxI,615
2
2
  osducli/__main__.py,sha256=4HonhahSaS3Un0f93qnbs_pmJ5pbbVHU-qdhsssVkB0,3661
3
3
  osducli/click_cli.py,sha256=7lpYqufxRSMrNZM9M-VANOYKwP0wo-1oxt2eSVHSW_M,10845
4
- osducli/cliclient.py,sha256=foKTioAXWakZdPx77Xq2LJASwBVMGQ4CdgsujdsYYhQ,12320
4
+ osducli/cliclient.py,sha256=sUQyIiomrf-WIcFn9C6UjISvHANLjijI-SVLxQ3T2MY,13242
5
5
  osducli/config.py,sha256=lSDxp15JiJQ_J_YjdvI1q243uexzxZpXSYMsSgQIgdQ,7802
6
6
  osducli/log.py,sha256=a5pzV2QIOqFEWCGFj01FaZk9PEzMkAr6duHei_dCme8,1549
7
7
  osducli/state.py,sha256=b0GHH2oZ-4ogtmHenNkYwNRSE3OpSTL0XklbKVjUAKQ,3335
@@ -106,9 +106,9 @@ osducli/util/file.py,sha256=866XSn7AWFXWgQ9B6OvPZVhb5p8VELbv_wOsUzc55-o,1821
106
106
  osducli/util/prompt.py,sha256=0i3eNnxOHRQstvsvfiKnN0lIxXu6sEXIcU8txeYRhNs,7492
107
107
  osducli/util/pypi.py,sha256=-DW5CThkKKiOwLp2tg85BmrLKZzkMI9pu8DyWNPZH6E,1192
108
108
  osducli/util/service_info.py,sha256=YsVvoRoeG1osFjql2AgVkGoj1TePuhBZf3CQXl2a9As,2577
109
- osducli-0.0.43.dist-info/LICENSE.md,sha256=9xnGPjJkOAgd0kH4QLlvOIYKqY1M49gWUQpoUxAU-9Y,12788
110
- osducli-0.0.43.dist-info/METADATA,sha256=TN9MQQQ-kNbxYuFRNkgSiIW_g6CnoVjHIVL79H9YjJo,6121
111
- osducli-0.0.43.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
112
- osducli-0.0.43.dist-info/entry_points.txt,sha256=gASIcihV0BSJDZOUK-zTzb8RiccZCvKfVZMna9RsEIg,47
113
- osducli-0.0.43.dist-info/top_level.txt,sha256=lqiP5fuyH8lx7c2emYoIVZNxZAPX-bSwnMH789wxUAY,8
114
- osducli-0.0.43.dist-info/RECORD,,
109
+ osducli-0.0.44.dist-info/LICENSE.md,sha256=9xnGPjJkOAgd0kH4QLlvOIYKqY1M49gWUQpoUxAU-9Y,12788
110
+ osducli-0.0.44.dist-info/METADATA,sha256=_9Md40hzE-qk91awyx96oZ-Op-MnlE-FK98chhGP6lQ,6190
111
+ osducli-0.0.44.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
112
+ osducli-0.0.44.dist-info/entry_points.txt,sha256=gASIcihV0BSJDZOUK-zTzb8RiccZCvKfVZMna9RsEIg,47
113
+ osducli-0.0.44.dist-info/top_level.txt,sha256=lqiP5fuyH8lx7c2emYoIVZNxZAPX-bSwnMH789wxUAY,8
114
+ osducli-0.0.44.dist-info/RECORD,,