ibm-cloud-sdk-core 3.18.2__tar.gz → 3.19.0__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 (68) hide show
  1. {ibm-cloud-sdk-core-3.18.2/ibm_cloud_sdk_core.egg-info → ibm-cloud-sdk-core-3.19.0}/PKG-INFO +2 -2
  2. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/README.md +1 -1
  3. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/api_exception.py +16 -2
  4. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/detailed_response.py +1 -1
  5. ibm-cloud-sdk-core-3.19.0/ibm_cloud_sdk_core/version.py +1 -0
  6. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0/ibm_cloud_sdk_core.egg-info}/PKG-INFO +2 -2
  7. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/setup.py +1 -1
  8. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_api_exception.py +1 -1
  9. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_base_service.py +7 -1
  10. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_container_token_manager.py +1 -1
  11. ibm-cloud-sdk-core-3.18.2/ibm_cloud_sdk_core/version.py +0 -1
  12. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/LICENSE +0 -0
  13. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/MANIFEST.in +0 -0
  14. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/__init__.py +0 -0
  15. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/authenticators/__init__.py +0 -0
  16. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/authenticators/authenticator.py +0 -0
  17. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/authenticators/basic_authenticator.py +0 -0
  18. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/authenticators/bearer_token_authenticator.py +0 -0
  19. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/authenticators/container_authenticator.py +0 -0
  20. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/authenticators/cp4d_authenticator.py +0 -0
  21. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/authenticators/iam_authenticator.py +0 -0
  22. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/authenticators/iam_request_based_authenticator.py +0 -0
  23. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/authenticators/mcsp_authenticator.py +0 -0
  24. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/authenticators/no_auth_authenticator.py +0 -0
  25. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/authenticators/vpc_instance_authenticator.py +0 -0
  26. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/base_service.py +0 -0
  27. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/get_authenticator.py +0 -0
  28. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/token_managers/__init__.py +0 -0
  29. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/token_managers/container_token_manager.py +0 -0
  30. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/token_managers/cp4d_token_manager.py +0 -0
  31. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/token_managers/iam_request_based_token_manager.py +0 -0
  32. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/token_managers/iam_token_manager.py +0 -0
  33. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/token_managers/jwt_token_manager.py +0 -0
  34. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/token_managers/mcsp_token_manager.py +0 -0
  35. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/token_managers/token_manager.py +0 -0
  36. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/token_managers/vpc_instance_token_manager.py +0 -0
  37. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core/utils.py +0 -0
  38. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core.egg-info/SOURCES.txt +0 -0
  39. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core.egg-info/dependency_links.txt +0 -0
  40. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core.egg-info/requires.txt +0 -0
  41. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core.egg-info/top_level.txt +0 -0
  42. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/ibm_cloud_sdk_core.egg-info/zip-safe +0 -0
  43. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/pyproject.toml +0 -0
  44. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/requirements-dev.txt +0 -0
  45. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/requirements.txt +0 -0
  46. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/setup.cfg +0 -0
  47. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/__init__.py +0 -0
  48. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_authenticator.py +0 -0
  49. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_basic_authenticator.py +0 -0
  50. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_bearer_authenticator.py +0 -0
  51. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_container_authenticator.py +0 -0
  52. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_cp4d_authenticator.py +0 -0
  53. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_cp4d_token_manager.py +0 -0
  54. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_detailed_response.py +0 -0
  55. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_iam_authenticator.py +0 -0
  56. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_iam_token_manager.py +0 -0
  57. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_jwt_token_manager.py +0 -0
  58. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_mcsp_authenticator.py +0 -0
  59. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_mcsp_token_manager.py +0 -0
  60. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_no_auth_authenticator.py +0 -0
  61. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_token_manager.py +0 -0
  62. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_utils.py +0 -0
  63. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_vpc_instance_authenticator.py +0 -0
  64. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test/test_vpc_instance_token_manager.py +0 -0
  65. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test_integration/__init__.py +0 -0
  66. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test_integration/test_cp4d_authenticator_integration.py +0 -0
  67. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test_integration/test_iam_authenticator_integration.py +0 -0
  68. {ibm-cloud-sdk-core-3.18.2 → ibm-cloud-sdk-core-3.19.0}/test_integration/test_mcsp_authenticator_integration.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ibm-cloud-sdk-core
3
- Version: 3.18.2
3
+ Version: 3.19.0
4
4
  Summary: Core library used by SDKs for IBM Cloud Services
5
5
  Home-page: https://github.com/IBM/python-sdk-core
6
6
  Author: IBM
@@ -29,7 +29,7 @@ License-File: LICENSE
29
29
  [![CLA assistant](https://cla-assistant.io/readme/badge/ibm/python-sdk-core)](https://cla-assistant.io/ibm/python-sdk-core)
30
30
  [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
31
31
 
32
- # IBM Python SDK Core Version 3.18.2
32
+ # IBM Python SDK Core Version 3.19.0
33
33
  This project contains core functionality required by Python code generated by the IBM Cloud OpenAPI SDK Generator
34
34
  (openapi-sdkgen).
35
35
 
@@ -4,7 +4,7 @@
4
4
  [![CLA assistant](https://cla-assistant.io/readme/badge/ibm/python-sdk-core)](https://cla-assistant.io/ibm/python-sdk-core)
5
5
  [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
6
6
 
7
- # IBM Python SDK Core Version 3.18.2
7
+ # IBM Python SDK Core Version 3.19.0
8
8
  This project contains core functionality required by Python code generated by the IBM Cloud OpenAPI SDK Generator
9
9
  (openapi-sdkgen).
10
10
 
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ import warnings
17
18
  from http import HTTPStatus
18
19
  from typing import Optional
19
20
 
@@ -39,15 +40,28 @@ class ApiException(Exception):
39
40
  # Call the base class constructor with the parameters it needs
40
41
  super().__init__(message)
41
42
  self.message = message
42
- self.code = code
43
+ self.status_code = code
43
44
  self.http_response = http_response
44
45
  self.global_transaction_id = None
45
46
  if http_response is not None:
46
47
  self.global_transaction_id = http_response.headers.get('X-Global-Transaction-ID')
47
48
  self.message = self.message if self.message else self._get_error_message(http_response)
48
49
 
50
+ # pylint: disable=fixme
51
+ # TODO: delete this by the end of 2024.
52
+ @property
53
+ def code(self):
54
+ """The old `code` property with a deprecation warning."""
55
+
56
+ warnings.warn(
57
+ 'Using the `code` attribute on the `ApiException` is deprecated and'
58
+ 'will be removed in the future. Use `status_code` instead.',
59
+ DeprecationWarning,
60
+ )
61
+ return self.status_code
62
+
49
63
  def __str__(self) -> str:
50
- msg = 'Error: ' + str(self.message) + ', Code: ' + str(self.code)
64
+ msg = 'Error: ' + str(self.message) + ', Status code: ' + str(self.status_code)
51
65
  if self.global_transaction_id is not None:
52
66
  msg += ' , X-global-transaction-id: ' + str(self.global_transaction_id)
53
67
  return msg
@@ -65,7 +65,7 @@ class DetailedResponse:
65
65
  """
66
66
  return self.headers
67
67
 
68
- def get_status_code(self) -> int:
68
+ def get_status_code(self) -> Union[int, None]:
69
69
  """The HTTP status code of the service request.
70
70
 
71
71
  Returns:
@@ -0,0 +1 @@
1
+ __version__ = '3.19.0'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ibm-cloud-sdk-core
3
- Version: 3.18.2
3
+ Version: 3.19.0
4
4
  Summary: Core library used by SDKs for IBM Cloud Services
5
5
  Home-page: https://github.com/IBM/python-sdk-core
6
6
  Author: IBM
@@ -29,7 +29,7 @@ License-File: LICENSE
29
29
  [![CLA assistant](https://cla-assistant.io/readme/badge/ibm/python-sdk-core)](https://cla-assistant.io/ibm/python-sdk-core)
30
30
  [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
31
31
 
32
- # IBM Python SDK Core Version 3.18.2
32
+ # IBM Python SDK Core Version 3.19.0
33
33
  This project contains core functionality required by Python code generated by the IBM Cloud OpenAPI SDK Generator
34
34
  (openapi-sdkgen).
35
35
 
@@ -19,7 +19,7 @@ import pkg_resources
19
19
  from setuptools import setup, find_packages
20
20
  from setuptools.command.test import test as TestCommand
21
21
 
22
- __version__ = '3.18.2'
22
+ __version__ = '3.19.0'
23
23
 
24
24
  if sys.argv[-1] == 'publish':
25
25
  # test server
@@ -85,4 +85,4 @@ def test_api_exception():
85
85
  mock_response = requests.get('https://test-for-text.com', timeout=None)
86
86
  exception = ApiException(500, http_response=mock_response)
87
87
  assert exception.message == 'plain text error'
88
- assert str(exception) == 'Error: plain text error, Code: 500 , X-global-transaction-id: xx'
88
+ assert str(exception) == 'Error: plain text error, Status code: 500 , X-global-transaction-id: xx'
@@ -1,5 +1,5 @@
1
1
  # coding=utf-8
2
- # pylint: disable=missing-docstring,protected-access,too-few-public-methods
2
+ # pylint: disable=missing-docstring,protected-access,too-few-public-methods,too-many-lines
3
3
  import gzip
4
4
  import json
5
5
  import os
@@ -357,6 +357,7 @@ def test_request_server_error():
357
357
  prepped = service.prepare_request('GET', url='')
358
358
  service.send(prepped)
359
359
  assert err.value.code == 500
360
+ assert err.value.status_code == 500
360
361
  assert err.value.http_response.headers['Content-Type'] == 'application/json'
361
362
  assert err.value.message == 'internal server error'
362
363
 
@@ -399,6 +400,7 @@ def test_request_success_invalid_json():
399
400
  prepped = service.prepare_request('GET', url='')
400
401
  service.send(prepped)
401
402
  assert err.value.code == 200
403
+ assert err.value.status_code == 200
402
404
  assert err.value.http_response.headers['Content-Type'] == 'application/json; charset=utf8'
403
405
  assert isinstance(err.value.__cause__, requests.exceptions.JSONDecodeError)
404
406
  assert "Expecting ':' delimiter: line 1" in str(err.value.__cause__)
@@ -453,6 +455,7 @@ def test_request_fail_401_nonerror_json():
453
455
  prepped = service.prepare_request('GET', url='')
454
456
  service.send(prepped)
455
457
  assert err.value.code == 401
458
+ assert err.value.status_code == 401
456
459
  assert err.value.http_response.headers['Content-Type'] == 'application/json'
457
460
  assert err.value.message == error_msg
458
461
 
@@ -473,6 +476,7 @@ def test_request_fail_401_error_json():
473
476
  prepped = service.prepare_request('GET', url='')
474
477
  service.send(prepped)
475
478
  assert err.value.code == 401
479
+ assert err.value.status_code == 401
476
480
  assert err.value.http_response.headers['Content-Type'] == 'application/json'
477
481
  assert err.value.message == error_msg
478
482
 
@@ -492,6 +496,7 @@ def test_request_fail_401_nonjson():
492
496
  prepped = service.prepare_request('GET', url='')
493
497
  service.send(prepped)
494
498
  assert err.value.code == 401
499
+ assert err.value.status_code == 401
495
500
  assert err.value.http_response.headers['Content-Type'] == 'text/plain'
496
501
  assert err.value.message == response_body
497
502
 
@@ -514,6 +519,7 @@ def test_request_fail_401_badjson():
514
519
  prepped = service.prepare_request('GET', url='')
515
520
  service.send(prepped)
516
521
  assert err.value.code == 401
522
+ assert err.value.status_code == 401
517
523
  assert err.value.http_response.headers['Content-Type'] == 'application/json'
518
524
  assert err.value.message == response_body
519
525
 
@@ -251,7 +251,7 @@ def test_authenticate_fail_iam():
251
251
  with pytest.raises(ApiException) as err:
252
252
  authenticator.authenticate(request)
253
253
 
254
- assert str(err.value) == 'Error: Bad Request, Code: 400'
254
+ assert str(err.value) == 'Error: Bad Request, Status code: 400'
255
255
 
256
256
 
257
257
  @mock_iam_response
@@ -1 +0,0 @@
1
- __version__ = '3.18.2'