amazon-creatorsapi-python-sdk 1.0.0__py3-none-any.whl → 1.2.0__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.
- {amazon_creatorsapi_python_sdk-1.0.0.dist-info → amazon_creatorsapi_python_sdk-1.2.0.dist-info}/METADATA +11 -5
- amazon_creatorsapi_python_sdk-1.2.0.dist-info/RECORD +109 -0
- {amazon_creatorsapi_python_sdk-1.0.0.dist-info → amazon_creatorsapi_python_sdk-1.2.0.dist-info}/WHEEL +1 -1
- creatorsapi_python_sdk/__init__.py +128 -127
- creatorsapi_python_sdk/api/__init__.py +5 -5
- creatorsapi_python_sdk/api/default_api.py +2427 -2412
- creatorsapi_python_sdk/api_client.py +915 -912
- creatorsapi_python_sdk/api_response.py +21 -21
- creatorsapi_python_sdk/auth/__init__.py +21 -21
- creatorsapi_python_sdk/auth/oauth2_config.py +139 -123
- creatorsapi_python_sdk/auth/oauth2_token_manager.py +133 -120
- creatorsapi_python_sdk/configuration.py +455 -455
- creatorsapi_python_sdk/exceptions.py +204 -204
- creatorsapi_python_sdk/models/__init__.py +111 -110
- creatorsapi_python_sdk/models/access_denied_exception_response_content.py +97 -97
- creatorsapi_python_sdk/models/access_denied_reason.py +45 -45
- creatorsapi_python_sdk/models/availability.py +44 -44
- creatorsapi_python_sdk/models/browse_node.py +116 -116
- creatorsapi_python_sdk/models/browse_node_ancestor.py +103 -103
- creatorsapi_python_sdk/models/browse_node_child.py +96 -96
- creatorsapi_python_sdk/models/browse_node_info.py +106 -106
- creatorsapi_python_sdk/models/browse_nodes_result.py +100 -100
- creatorsapi_python_sdk/models/by_line_info.py +111 -111
- creatorsapi_python_sdk/models/classifications.py +101 -101
- creatorsapi_python_sdk/models/condition.py +44 -44
- creatorsapi_python_sdk/models/content_info.py +113 -113
- creatorsapi_python_sdk/models/content_rating.py +96 -96
- creatorsapi_python_sdk/models/contributor.py +98 -98
- creatorsapi_python_sdk/models/customer_reviews.py +98 -98
- creatorsapi_python_sdk/models/deal_details.py +102 -102
- creatorsapi_python_sdk/models/delivery_flag.py +46 -46
- creatorsapi_python_sdk/models/dimension_based_attribute.py +111 -111
- creatorsapi_python_sdk/models/error_data.py +94 -94
- creatorsapi_python_sdk/models/external_ids.py +106 -106
- creatorsapi_python_sdk/models/feed.py +98 -98
- creatorsapi_python_sdk/models/get_browse_nodes_request_content.py +107 -107
- creatorsapi_python_sdk/models/get_browse_nodes_resource.py +44 -44
- creatorsapi_python_sdk/models/get_browse_nodes_response_content.py +106 -106
- creatorsapi_python_sdk/models/get_feed_request_content.py +93 -93
- creatorsapi_python_sdk/models/get_feed_response_content.py +92 -92
- creatorsapi_python_sdk/models/get_items_request_content.py +124 -124
- creatorsapi_python_sdk/models/get_items_resource.py +76 -76
- creatorsapi_python_sdk/models/get_items_response_content.py +106 -106
- creatorsapi_python_sdk/models/get_report_request_content.py +93 -93
- creatorsapi_python_sdk/models/get_report_response_content.py +92 -92
- creatorsapi_python_sdk/models/get_variations_request_content.py +135 -135
- creatorsapi_python_sdk/models/get_variations_resource.py +79 -79
- creatorsapi_python_sdk/models/get_variations_response_content.py +106 -106
- creatorsapi_python_sdk/models/image_size.py +96 -96
- creatorsapi_python_sdk/models/image_type.py +111 -111
- creatorsapi_python_sdk/models/images.py +105 -105
- creatorsapi_python_sdk/models/internal_server_exception_response_content.py +94 -94
- creatorsapi_python_sdk/models/item.py +138 -138
- creatorsapi_python_sdk/models/item_info.py +156 -156
- creatorsapi_python_sdk/models/items_result.py +100 -100
- creatorsapi_python_sdk/models/language_type.py +94 -94
- creatorsapi_python_sdk/models/languages.py +104 -104
- creatorsapi_python_sdk/models/list_feeds_response_content.py +100 -100
- creatorsapi_python_sdk/models/list_reports_response_content.py +100 -100
- creatorsapi_python_sdk/models/manufacture_info.py +106 -106
- creatorsapi_python_sdk/models/money.py +96 -96
- creatorsapi_python_sdk/models/multi_valued_attribute.py +96 -96
- creatorsapi_python_sdk/models/offer_availability_v2.py +98 -98
- creatorsapi_python_sdk/models/offer_condition_v2.py +96 -96
- creatorsapi_python_sdk/models/offer_listing_v2.py +133 -133
- creatorsapi_python_sdk/models/offer_loyalty_points_v2.py +92 -92
- creatorsapi_python_sdk/models/offer_merchant_info_v2.py +94 -94
- creatorsapi_python_sdk/models/offer_price_v2.py +113 -113
- creatorsapi_python_sdk/models/offer_saving_basis.py +101 -101
- creatorsapi_python_sdk/models/offer_savings.py +98 -98
- creatorsapi_python_sdk/models/offer_type.py +45 -45
- creatorsapi_python_sdk/models/offers_v2.py +100 -100
- creatorsapi_python_sdk/models/product_info.py +124 -124
- creatorsapi_python_sdk/models/rating.py +92 -92
- creatorsapi_python_sdk/models/refinement.py +104 -104
- creatorsapi_python_sdk/models/refinement_bin.py +94 -94
- creatorsapi_python_sdk/models/report_metadata.py +98 -98
- creatorsapi_python_sdk/models/resource_not_found_exception_response_content.py +98 -98
- creatorsapi_python_sdk/models/saving_basis_type.py +46 -46
- creatorsapi_python_sdk/models/search_items_request_content.py +242 -242
- creatorsapi_python_sdk/models/search_items_resource.py +77 -77
- creatorsapi_python_sdk/models/search_items_response_content.py +106 -106
- creatorsapi_python_sdk/models/search_refinements.py +110 -110
- creatorsapi_python_sdk/models/search_result.py +110 -110
- creatorsapi_python_sdk/models/single_boolean_valued_attribute.py +96 -96
- creatorsapi_python_sdk/models/single_integer_valued_attribute.py +96 -96
- creatorsapi_python_sdk/models/single_string_valued_attribute.py +96 -96
- creatorsapi_python_sdk/models/sort_by.py +48 -48
- creatorsapi_python_sdk/models/technical_info.py +102 -102
- creatorsapi_python_sdk/models/throttle_exception_response_content.py +98 -98
- creatorsapi_python_sdk/models/trade_in_info.py +98 -98
- creatorsapi_python_sdk/models/trade_in_price.py +96 -96
- creatorsapi_python_sdk/models/unauthorized_exception_reason.py +51 -51
- creatorsapi_python_sdk/models/unauthorized_exception_response_content.py +97 -97
- creatorsapi_python_sdk/models/unit_based_attribute.py +98 -98
- creatorsapi_python_sdk/models/validation_exception_field.py +94 -94
- creatorsapi_python_sdk/models/validation_exception_reason.py +48 -48
- creatorsapi_python_sdk/models/validation_exception_response_content.py +107 -107
- creatorsapi_python_sdk/models/variation_attribute.py +94 -94
- creatorsapi_python_sdk/models/variation_dimension.py +98 -98
- creatorsapi_python_sdk/models/variation_summary.py +110 -104
- creatorsapi_python_sdk/models/variation_summary_price.py +101 -0
- creatorsapi_python_sdk/models/variations_result.py +106 -106
- creatorsapi_python_sdk/models/website_sales_rank.py +98 -98
- creatorsapi_python_sdk/rest.py +262 -262
- amazon_creatorsapi_python_sdk-1.0.0.dist-info/RECORD +0 -108
- {amazon_creatorsapi_python_sdk-1.0.0.dist-info → amazon_creatorsapi_python_sdk-1.2.0.dist-info}/licenses/LICENSE.txt +0 -0
- {amazon_creatorsapi_python_sdk-1.0.0.dist-info → amazon_creatorsapi_python_sdk-1.2.0.dist-info}/licenses/NOTICE.txt +0 -0
- {amazon_creatorsapi_python_sdk-1.0.0.dist-info → amazon_creatorsapi_python_sdk-1.2.0.dist-info}/top_level.txt +0 -0
|
@@ -1,204 +1,204 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
|
|
3
|
-
"""
|
|
4
|
-
Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
|
-
|
|
6
|
-
Licensed under the Apache License, Version 2.0 (the "License").
|
|
7
|
-
You may not use this file except in compliance with the License.
|
|
8
|
-
A copy of the License is located at
|
|
9
|
-
|
|
10
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
|
|
12
|
-
or in the "license" file accompanying this file. This file is distributed
|
|
13
|
-
on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
14
|
-
express or implied. See the License for the specific language governing
|
|
15
|
-
permissions and limitations under the License.
|
|
16
|
-
|
|
17
|
-
""" # noqa: E501
|
|
18
|
-
|
|
19
|
-
from typing import Any, Optional
|
|
20
|
-
from typing_extensions import Self
|
|
21
|
-
|
|
22
|
-
class OpenApiException(Exception):
|
|
23
|
-
"""The base exception class for all OpenAPIExceptions"""
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class ApiTypeError(OpenApiException, TypeError):
|
|
27
|
-
def __init__(self, msg, path_to_item=None, valid_classes=None,
|
|
28
|
-
key_type=None) -> None:
|
|
29
|
-
""" Raises an exception for TypeErrors
|
|
30
|
-
|
|
31
|
-
Args:
|
|
32
|
-
msg (str): the exception message
|
|
33
|
-
|
|
34
|
-
Keyword Args:
|
|
35
|
-
path_to_item (list): a list of keys an indices to get to the
|
|
36
|
-
current_item
|
|
37
|
-
None if unset
|
|
38
|
-
valid_classes (tuple): the primitive classes that current item
|
|
39
|
-
should be an instance of
|
|
40
|
-
None if unset
|
|
41
|
-
key_type (bool): False if our value is a value in a dict
|
|
42
|
-
True if it is a key in a dict
|
|
43
|
-
False if our item is an item in a list
|
|
44
|
-
None if unset
|
|
45
|
-
"""
|
|
46
|
-
self.path_to_item = path_to_item
|
|
47
|
-
self.valid_classes = valid_classes
|
|
48
|
-
self.key_type = key_type
|
|
49
|
-
full_msg = msg
|
|
50
|
-
if path_to_item:
|
|
51
|
-
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
52
|
-
super(ApiTypeError, self).__init__(full_msg)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
class ApiValueError(OpenApiException, ValueError):
|
|
56
|
-
def __init__(self, msg, path_to_item=None) -> None:
|
|
57
|
-
"""
|
|
58
|
-
Args:
|
|
59
|
-
msg (str): the exception message
|
|
60
|
-
|
|
61
|
-
Keyword Args:
|
|
62
|
-
path_to_item (list) the path to the exception in the
|
|
63
|
-
received_data dict. None if unset
|
|
64
|
-
"""
|
|
65
|
-
|
|
66
|
-
self.path_to_item = path_to_item
|
|
67
|
-
full_msg = msg
|
|
68
|
-
if path_to_item:
|
|
69
|
-
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
70
|
-
super(ApiValueError, self).__init__(full_msg)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
class ApiAttributeError(OpenApiException, AttributeError):
|
|
74
|
-
def __init__(self, msg, path_to_item=None) -> None:
|
|
75
|
-
"""
|
|
76
|
-
Raised when an attribute reference or assignment fails.
|
|
77
|
-
|
|
78
|
-
Args:
|
|
79
|
-
msg (str): the exception message
|
|
80
|
-
|
|
81
|
-
Keyword Args:
|
|
82
|
-
path_to_item (None/list) the path to the exception in the
|
|
83
|
-
received_data dict
|
|
84
|
-
"""
|
|
85
|
-
self.path_to_item = path_to_item
|
|
86
|
-
full_msg = msg
|
|
87
|
-
if path_to_item:
|
|
88
|
-
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
89
|
-
super(ApiAttributeError, self).__init__(full_msg)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
class ApiKeyError(OpenApiException, KeyError):
|
|
93
|
-
def __init__(self, msg, path_to_item=None) -> None:
|
|
94
|
-
"""
|
|
95
|
-
Args:
|
|
96
|
-
msg (str): the exception message
|
|
97
|
-
|
|
98
|
-
Keyword Args:
|
|
99
|
-
path_to_item (None/list) the path to the exception in the
|
|
100
|
-
received_data dict
|
|
101
|
-
"""
|
|
102
|
-
self.path_to_item = path_to_item
|
|
103
|
-
full_msg = msg
|
|
104
|
-
if path_to_item:
|
|
105
|
-
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
106
|
-
super(ApiKeyError, self).__init__(full_msg)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
class ApiException(OpenApiException):
|
|
110
|
-
|
|
111
|
-
def __init__(
|
|
112
|
-
self,
|
|
113
|
-
status=None,
|
|
114
|
-
reason=None,
|
|
115
|
-
http_resp=None,
|
|
116
|
-
*,
|
|
117
|
-
body: Optional[str] = None,
|
|
118
|
-
data: Optional[Any] = None,
|
|
119
|
-
) -> None:
|
|
120
|
-
self.status = status
|
|
121
|
-
self.reason = reason
|
|
122
|
-
self.body = body
|
|
123
|
-
self.data = data
|
|
124
|
-
self.headers = None
|
|
125
|
-
|
|
126
|
-
if http_resp:
|
|
127
|
-
if self.status is None:
|
|
128
|
-
self.status = http_resp.status
|
|
129
|
-
if self.reason is None:
|
|
130
|
-
self.reason = http_resp.reason
|
|
131
|
-
if self.body is None:
|
|
132
|
-
try:
|
|
133
|
-
self.body = http_resp.data.decode('utf-8')
|
|
134
|
-
except Exception:
|
|
135
|
-
pass
|
|
136
|
-
self.headers = http_resp.getheaders()
|
|
137
|
-
|
|
138
|
-
@classmethod
|
|
139
|
-
def from_response(
|
|
140
|
-
cls,
|
|
141
|
-
*,
|
|
142
|
-
http_resp,
|
|
143
|
-
body: Optional[str],
|
|
144
|
-
data: Optional[Any],
|
|
145
|
-
) -> Self:
|
|
146
|
-
if http_resp.status == 400:
|
|
147
|
-
raise BadRequestException(http_resp=http_resp, body=body, data=data)
|
|
148
|
-
|
|
149
|
-
if http_resp.status == 401:
|
|
150
|
-
raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
|
|
151
|
-
|
|
152
|
-
if http_resp.status == 403:
|
|
153
|
-
raise ForbiddenException(http_resp=http_resp, body=body, data=data)
|
|
154
|
-
|
|
155
|
-
if http_resp.status == 404:
|
|
156
|
-
raise NotFoundException(http_resp=http_resp, body=body, data=data)
|
|
157
|
-
|
|
158
|
-
if 500 <= http_resp.status <= 599:
|
|
159
|
-
raise ServiceException(http_resp=http_resp, body=body, data=data)
|
|
160
|
-
raise ApiException(http_resp=http_resp, body=body, data=data)
|
|
161
|
-
|
|
162
|
-
def __str__(self):
|
|
163
|
-
"""Custom error messages for exception"""
|
|
164
|
-
error_message = "({0})\n"\
|
|
165
|
-
"Reason: {1}\n".format(self.status, self.reason)
|
|
166
|
-
if self.headers:
|
|
167
|
-
error_message += "HTTP response headers: {0}\n".format(
|
|
168
|
-
self.headers)
|
|
169
|
-
|
|
170
|
-
if self.data or self.body:
|
|
171
|
-
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
|
|
172
|
-
|
|
173
|
-
return error_message
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
class BadRequestException(ApiException):
|
|
177
|
-
pass
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
class NotFoundException(ApiException):
|
|
181
|
-
pass
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
class UnauthorizedException(ApiException):
|
|
185
|
-
pass
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
class ForbiddenException(ApiException):
|
|
189
|
-
pass
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
class ServiceException(ApiException):
|
|
193
|
-
pass
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
def render_path(path_to_item):
|
|
197
|
-
"""Returns a string representation of a path"""
|
|
198
|
-
result = ""
|
|
199
|
-
for pth in path_to_item:
|
|
200
|
-
if isinstance(pth, int):
|
|
201
|
-
result += "[{0}]".format(pth)
|
|
202
|
-
else:
|
|
203
|
-
result += "['{0}']".format(pth)
|
|
204
|
-
return result
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
|
+
|
|
6
|
+
Licensed under the Apache License, Version 2.0 (the "License").
|
|
7
|
+
You may not use this file except in compliance with the License.
|
|
8
|
+
A copy of the License is located at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
or in the "license" file accompanying this file. This file is distributed
|
|
13
|
+
on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
14
|
+
express or implied. See the License for the specific language governing
|
|
15
|
+
permissions and limitations under the License.
|
|
16
|
+
|
|
17
|
+
""" # noqa: E501
|
|
18
|
+
|
|
19
|
+
from typing import Any, Optional
|
|
20
|
+
from typing_extensions import Self
|
|
21
|
+
|
|
22
|
+
class OpenApiException(Exception):
|
|
23
|
+
"""The base exception class for all OpenAPIExceptions"""
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ApiTypeError(OpenApiException, TypeError):
|
|
27
|
+
def __init__(self, msg, path_to_item=None, valid_classes=None,
|
|
28
|
+
key_type=None) -> None:
|
|
29
|
+
""" Raises an exception for TypeErrors
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
msg (str): the exception message
|
|
33
|
+
|
|
34
|
+
Keyword Args:
|
|
35
|
+
path_to_item (list): a list of keys an indices to get to the
|
|
36
|
+
current_item
|
|
37
|
+
None if unset
|
|
38
|
+
valid_classes (tuple): the primitive classes that current item
|
|
39
|
+
should be an instance of
|
|
40
|
+
None if unset
|
|
41
|
+
key_type (bool): False if our value is a value in a dict
|
|
42
|
+
True if it is a key in a dict
|
|
43
|
+
False if our item is an item in a list
|
|
44
|
+
None if unset
|
|
45
|
+
"""
|
|
46
|
+
self.path_to_item = path_to_item
|
|
47
|
+
self.valid_classes = valid_classes
|
|
48
|
+
self.key_type = key_type
|
|
49
|
+
full_msg = msg
|
|
50
|
+
if path_to_item:
|
|
51
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
52
|
+
super(ApiTypeError, self).__init__(full_msg)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class ApiValueError(OpenApiException, ValueError):
|
|
56
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
57
|
+
"""
|
|
58
|
+
Args:
|
|
59
|
+
msg (str): the exception message
|
|
60
|
+
|
|
61
|
+
Keyword Args:
|
|
62
|
+
path_to_item (list) the path to the exception in the
|
|
63
|
+
received_data dict. None if unset
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
self.path_to_item = path_to_item
|
|
67
|
+
full_msg = msg
|
|
68
|
+
if path_to_item:
|
|
69
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
70
|
+
super(ApiValueError, self).__init__(full_msg)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class ApiAttributeError(OpenApiException, AttributeError):
|
|
74
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
75
|
+
"""
|
|
76
|
+
Raised when an attribute reference or assignment fails.
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
msg (str): the exception message
|
|
80
|
+
|
|
81
|
+
Keyword Args:
|
|
82
|
+
path_to_item (None/list) the path to the exception in the
|
|
83
|
+
received_data dict
|
|
84
|
+
"""
|
|
85
|
+
self.path_to_item = path_to_item
|
|
86
|
+
full_msg = msg
|
|
87
|
+
if path_to_item:
|
|
88
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
89
|
+
super(ApiAttributeError, self).__init__(full_msg)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class ApiKeyError(OpenApiException, KeyError):
|
|
93
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
94
|
+
"""
|
|
95
|
+
Args:
|
|
96
|
+
msg (str): the exception message
|
|
97
|
+
|
|
98
|
+
Keyword Args:
|
|
99
|
+
path_to_item (None/list) the path to the exception in the
|
|
100
|
+
received_data dict
|
|
101
|
+
"""
|
|
102
|
+
self.path_to_item = path_to_item
|
|
103
|
+
full_msg = msg
|
|
104
|
+
if path_to_item:
|
|
105
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
106
|
+
super(ApiKeyError, self).__init__(full_msg)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class ApiException(OpenApiException):
|
|
110
|
+
|
|
111
|
+
def __init__(
|
|
112
|
+
self,
|
|
113
|
+
status=None,
|
|
114
|
+
reason=None,
|
|
115
|
+
http_resp=None,
|
|
116
|
+
*,
|
|
117
|
+
body: Optional[str] = None,
|
|
118
|
+
data: Optional[Any] = None,
|
|
119
|
+
) -> None:
|
|
120
|
+
self.status = status
|
|
121
|
+
self.reason = reason
|
|
122
|
+
self.body = body
|
|
123
|
+
self.data = data
|
|
124
|
+
self.headers = None
|
|
125
|
+
|
|
126
|
+
if http_resp:
|
|
127
|
+
if self.status is None:
|
|
128
|
+
self.status = http_resp.status
|
|
129
|
+
if self.reason is None:
|
|
130
|
+
self.reason = http_resp.reason
|
|
131
|
+
if self.body is None:
|
|
132
|
+
try:
|
|
133
|
+
self.body = http_resp.data.decode('utf-8')
|
|
134
|
+
except Exception:
|
|
135
|
+
pass
|
|
136
|
+
self.headers = http_resp.getheaders()
|
|
137
|
+
|
|
138
|
+
@classmethod
|
|
139
|
+
def from_response(
|
|
140
|
+
cls,
|
|
141
|
+
*,
|
|
142
|
+
http_resp,
|
|
143
|
+
body: Optional[str],
|
|
144
|
+
data: Optional[Any],
|
|
145
|
+
) -> Self:
|
|
146
|
+
if http_resp.status == 400:
|
|
147
|
+
raise BadRequestException(http_resp=http_resp, body=body, data=data)
|
|
148
|
+
|
|
149
|
+
if http_resp.status == 401:
|
|
150
|
+
raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
|
|
151
|
+
|
|
152
|
+
if http_resp.status == 403:
|
|
153
|
+
raise ForbiddenException(http_resp=http_resp, body=body, data=data)
|
|
154
|
+
|
|
155
|
+
if http_resp.status == 404:
|
|
156
|
+
raise NotFoundException(http_resp=http_resp, body=body, data=data)
|
|
157
|
+
|
|
158
|
+
if 500 <= http_resp.status <= 599:
|
|
159
|
+
raise ServiceException(http_resp=http_resp, body=body, data=data)
|
|
160
|
+
raise ApiException(http_resp=http_resp, body=body, data=data)
|
|
161
|
+
|
|
162
|
+
def __str__(self):
|
|
163
|
+
"""Custom error messages for exception"""
|
|
164
|
+
error_message = "({0})\n"\
|
|
165
|
+
"Reason: {1}\n".format(self.status, self.reason)
|
|
166
|
+
if self.headers:
|
|
167
|
+
error_message += "HTTP response headers: {0}\n".format(
|
|
168
|
+
self.headers)
|
|
169
|
+
|
|
170
|
+
if self.data or self.body:
|
|
171
|
+
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
|
|
172
|
+
|
|
173
|
+
return error_message
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
class BadRequestException(ApiException):
|
|
177
|
+
pass
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
class NotFoundException(ApiException):
|
|
181
|
+
pass
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
class UnauthorizedException(ApiException):
|
|
185
|
+
pass
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class ForbiddenException(ApiException):
|
|
189
|
+
pass
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
class ServiceException(ApiException):
|
|
193
|
+
pass
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def render_path(path_to_item):
|
|
197
|
+
"""Returns a string representation of a path"""
|
|
198
|
+
result = ""
|
|
199
|
+
for pth in path_to_item:
|
|
200
|
+
if isinstance(pth, int):
|
|
201
|
+
result += "[{0}]".format(pth)
|
|
202
|
+
else:
|
|
203
|
+
result += "['{0}']".format(pth)
|
|
204
|
+
return result
|
|
@@ -1,110 +1,111 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
|
|
3
|
-
# flake8: noqa
|
|
4
|
-
"""
|
|
5
|
-
Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
|
-
|
|
7
|
-
Licensed under the Apache License, Version 2.0 (the "License").
|
|
8
|
-
You may not use this file except in compliance with the License.
|
|
9
|
-
A copy of the License is located at
|
|
10
|
-
|
|
11
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
or in the "license" file accompanying this file. This file is distributed
|
|
14
|
-
on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
15
|
-
express or implied. See the License for the specific language governing
|
|
16
|
-
permissions and limitations under the License.
|
|
17
|
-
|
|
18
|
-
""" # noqa: E501
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
# import models into model package
|
|
22
|
-
from creatorsapi_python_sdk.models.access_denied_exception_response_content import AccessDeniedExceptionResponseContent
|
|
23
|
-
from creatorsapi_python_sdk.models.access_denied_reason import AccessDeniedReason
|
|
24
|
-
from creatorsapi_python_sdk.models.availability import Availability
|
|
25
|
-
from creatorsapi_python_sdk.models.browse_node import BrowseNode
|
|
26
|
-
from creatorsapi_python_sdk.models.browse_node_ancestor import BrowseNodeAncestor
|
|
27
|
-
from creatorsapi_python_sdk.models.browse_node_child import BrowseNodeChild
|
|
28
|
-
from creatorsapi_python_sdk.models.browse_node_info import BrowseNodeInfo
|
|
29
|
-
from creatorsapi_python_sdk.models.browse_nodes_result import BrowseNodesResult
|
|
30
|
-
from creatorsapi_python_sdk.models.by_line_info import ByLineInfo
|
|
31
|
-
from creatorsapi_python_sdk.models.classifications import Classifications
|
|
32
|
-
from creatorsapi_python_sdk.models.condition import Condition
|
|
33
|
-
from creatorsapi_python_sdk.models.content_info import ContentInfo
|
|
34
|
-
from creatorsapi_python_sdk.models.content_rating import ContentRating
|
|
35
|
-
from creatorsapi_python_sdk.models.contributor import Contributor
|
|
36
|
-
from creatorsapi_python_sdk.models.customer_reviews import CustomerReviews
|
|
37
|
-
from creatorsapi_python_sdk.models.deal_details import DealDetails
|
|
38
|
-
from creatorsapi_python_sdk.models.delivery_flag import DeliveryFlag
|
|
39
|
-
from creatorsapi_python_sdk.models.dimension_based_attribute import DimensionBasedAttribute
|
|
40
|
-
from creatorsapi_python_sdk.models.error_data import ErrorData
|
|
41
|
-
from creatorsapi_python_sdk.models.external_ids import ExternalIds
|
|
42
|
-
from creatorsapi_python_sdk.models.feed import Feed
|
|
43
|
-
from creatorsapi_python_sdk.models.get_browse_nodes_request_content import GetBrowseNodesRequestContent
|
|
44
|
-
from creatorsapi_python_sdk.models.get_browse_nodes_resource import GetBrowseNodesResource
|
|
45
|
-
from creatorsapi_python_sdk.models.get_browse_nodes_response_content import GetBrowseNodesResponseContent
|
|
46
|
-
from creatorsapi_python_sdk.models.get_feed_request_content import GetFeedRequestContent
|
|
47
|
-
from creatorsapi_python_sdk.models.get_feed_response_content import GetFeedResponseContent
|
|
48
|
-
from creatorsapi_python_sdk.models.get_items_request_content import GetItemsRequestContent
|
|
49
|
-
from creatorsapi_python_sdk.models.get_items_resource import GetItemsResource
|
|
50
|
-
from creatorsapi_python_sdk.models.get_items_response_content import GetItemsResponseContent
|
|
51
|
-
from creatorsapi_python_sdk.models.get_report_request_content import GetReportRequestContent
|
|
52
|
-
from creatorsapi_python_sdk.models.get_report_response_content import GetReportResponseContent
|
|
53
|
-
from creatorsapi_python_sdk.models.get_variations_request_content import GetVariationsRequestContent
|
|
54
|
-
from creatorsapi_python_sdk.models.get_variations_resource import GetVariationsResource
|
|
55
|
-
from creatorsapi_python_sdk.models.get_variations_response_content import GetVariationsResponseContent
|
|
56
|
-
from creatorsapi_python_sdk.models.image_size import ImageSize
|
|
57
|
-
from creatorsapi_python_sdk.models.image_type import ImageType
|
|
58
|
-
from creatorsapi_python_sdk.models.images import Images
|
|
59
|
-
from creatorsapi_python_sdk.models.internal_server_exception_response_content import InternalServerExceptionResponseContent
|
|
60
|
-
from creatorsapi_python_sdk.models.item import Item
|
|
61
|
-
from creatorsapi_python_sdk.models.item_info import ItemInfo
|
|
62
|
-
from creatorsapi_python_sdk.models.items_result import ItemsResult
|
|
63
|
-
from creatorsapi_python_sdk.models.language_type import LanguageType
|
|
64
|
-
from creatorsapi_python_sdk.models.languages import Languages
|
|
65
|
-
from creatorsapi_python_sdk.models.list_feeds_response_content import ListFeedsResponseContent
|
|
66
|
-
from creatorsapi_python_sdk.models.list_reports_response_content import ListReportsResponseContent
|
|
67
|
-
from creatorsapi_python_sdk.models.manufacture_info import ManufactureInfo
|
|
68
|
-
from creatorsapi_python_sdk.models.money import Money
|
|
69
|
-
from creatorsapi_python_sdk.models.multi_valued_attribute import MultiValuedAttribute
|
|
70
|
-
from creatorsapi_python_sdk.models.offer_availability_v2 import OfferAvailabilityV2
|
|
71
|
-
from creatorsapi_python_sdk.models.offer_condition_v2 import OfferConditionV2
|
|
72
|
-
from creatorsapi_python_sdk.models.offer_listing_v2 import OfferListingV2
|
|
73
|
-
from creatorsapi_python_sdk.models.offer_loyalty_points_v2 import OfferLoyaltyPointsV2
|
|
74
|
-
from creatorsapi_python_sdk.models.offer_merchant_info_v2 import OfferMerchantInfoV2
|
|
75
|
-
from creatorsapi_python_sdk.models.offer_price_v2 import OfferPriceV2
|
|
76
|
-
from creatorsapi_python_sdk.models.offer_saving_basis import OfferSavingBasis
|
|
77
|
-
from creatorsapi_python_sdk.models.offer_savings import OfferSavings
|
|
78
|
-
from creatorsapi_python_sdk.models.offer_type import OfferType
|
|
79
|
-
from creatorsapi_python_sdk.models.offers_v2 import OffersV2
|
|
80
|
-
from creatorsapi_python_sdk.models.product_info import ProductInfo
|
|
81
|
-
from creatorsapi_python_sdk.models.rating import Rating
|
|
82
|
-
from creatorsapi_python_sdk.models.refinement import Refinement
|
|
83
|
-
from creatorsapi_python_sdk.models.refinement_bin import RefinementBin
|
|
84
|
-
from creatorsapi_python_sdk.models.report_metadata import ReportMetadata
|
|
85
|
-
from creatorsapi_python_sdk.models.resource_not_found_exception_response_content import ResourceNotFoundExceptionResponseContent
|
|
86
|
-
from creatorsapi_python_sdk.models.saving_basis_type import SavingBasisType
|
|
87
|
-
from creatorsapi_python_sdk.models.search_items_request_content import SearchItemsRequestContent
|
|
88
|
-
from creatorsapi_python_sdk.models.search_items_resource import SearchItemsResource
|
|
89
|
-
from creatorsapi_python_sdk.models.search_items_response_content import SearchItemsResponseContent
|
|
90
|
-
from creatorsapi_python_sdk.models.search_refinements import SearchRefinements
|
|
91
|
-
from creatorsapi_python_sdk.models.search_result import SearchResult
|
|
92
|
-
from creatorsapi_python_sdk.models.single_boolean_valued_attribute import SingleBooleanValuedAttribute
|
|
93
|
-
from creatorsapi_python_sdk.models.single_integer_valued_attribute import SingleIntegerValuedAttribute
|
|
94
|
-
from creatorsapi_python_sdk.models.single_string_valued_attribute import SingleStringValuedAttribute
|
|
95
|
-
from creatorsapi_python_sdk.models.sort_by import SortBy
|
|
96
|
-
from creatorsapi_python_sdk.models.technical_info import TechnicalInfo
|
|
97
|
-
from creatorsapi_python_sdk.models.throttle_exception_response_content import ThrottleExceptionResponseContent
|
|
98
|
-
from creatorsapi_python_sdk.models.trade_in_info import TradeInInfo
|
|
99
|
-
from creatorsapi_python_sdk.models.trade_in_price import TradeInPrice
|
|
100
|
-
from creatorsapi_python_sdk.models.unauthorized_exception_reason import UnauthorizedExceptionReason
|
|
101
|
-
from creatorsapi_python_sdk.models.unauthorized_exception_response_content import UnauthorizedExceptionResponseContent
|
|
102
|
-
from creatorsapi_python_sdk.models.unit_based_attribute import UnitBasedAttribute
|
|
103
|
-
from creatorsapi_python_sdk.models.validation_exception_field import ValidationExceptionField
|
|
104
|
-
from creatorsapi_python_sdk.models.validation_exception_reason import ValidationExceptionReason
|
|
105
|
-
from creatorsapi_python_sdk.models.validation_exception_response_content import ValidationExceptionResponseContent
|
|
106
|
-
from creatorsapi_python_sdk.models.variation_attribute import VariationAttribute
|
|
107
|
-
from creatorsapi_python_sdk.models.variation_dimension import VariationDimension
|
|
108
|
-
from creatorsapi_python_sdk.models.variation_summary import VariationSummary
|
|
109
|
-
from creatorsapi_python_sdk.models.
|
|
110
|
-
from creatorsapi_python_sdk.models.
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
# flake8: noqa
|
|
4
|
+
"""
|
|
5
|
+
Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License").
|
|
8
|
+
You may not use this file except in compliance with the License.
|
|
9
|
+
A copy of the License is located at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
or in the "license" file accompanying this file. This file is distributed
|
|
14
|
+
on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
15
|
+
express or implied. See the License for the specific language governing
|
|
16
|
+
permissions and limitations under the License.
|
|
17
|
+
|
|
18
|
+
""" # noqa: E501
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# import models into model package
|
|
22
|
+
from creatorsapi_python_sdk.models.access_denied_exception_response_content import AccessDeniedExceptionResponseContent
|
|
23
|
+
from creatorsapi_python_sdk.models.access_denied_reason import AccessDeniedReason
|
|
24
|
+
from creatorsapi_python_sdk.models.availability import Availability
|
|
25
|
+
from creatorsapi_python_sdk.models.browse_node import BrowseNode
|
|
26
|
+
from creatorsapi_python_sdk.models.browse_node_ancestor import BrowseNodeAncestor
|
|
27
|
+
from creatorsapi_python_sdk.models.browse_node_child import BrowseNodeChild
|
|
28
|
+
from creatorsapi_python_sdk.models.browse_node_info import BrowseNodeInfo
|
|
29
|
+
from creatorsapi_python_sdk.models.browse_nodes_result import BrowseNodesResult
|
|
30
|
+
from creatorsapi_python_sdk.models.by_line_info import ByLineInfo
|
|
31
|
+
from creatorsapi_python_sdk.models.classifications import Classifications
|
|
32
|
+
from creatorsapi_python_sdk.models.condition import Condition
|
|
33
|
+
from creatorsapi_python_sdk.models.content_info import ContentInfo
|
|
34
|
+
from creatorsapi_python_sdk.models.content_rating import ContentRating
|
|
35
|
+
from creatorsapi_python_sdk.models.contributor import Contributor
|
|
36
|
+
from creatorsapi_python_sdk.models.customer_reviews import CustomerReviews
|
|
37
|
+
from creatorsapi_python_sdk.models.deal_details import DealDetails
|
|
38
|
+
from creatorsapi_python_sdk.models.delivery_flag import DeliveryFlag
|
|
39
|
+
from creatorsapi_python_sdk.models.dimension_based_attribute import DimensionBasedAttribute
|
|
40
|
+
from creatorsapi_python_sdk.models.error_data import ErrorData
|
|
41
|
+
from creatorsapi_python_sdk.models.external_ids import ExternalIds
|
|
42
|
+
from creatorsapi_python_sdk.models.feed import Feed
|
|
43
|
+
from creatorsapi_python_sdk.models.get_browse_nodes_request_content import GetBrowseNodesRequestContent
|
|
44
|
+
from creatorsapi_python_sdk.models.get_browse_nodes_resource import GetBrowseNodesResource
|
|
45
|
+
from creatorsapi_python_sdk.models.get_browse_nodes_response_content import GetBrowseNodesResponseContent
|
|
46
|
+
from creatorsapi_python_sdk.models.get_feed_request_content import GetFeedRequestContent
|
|
47
|
+
from creatorsapi_python_sdk.models.get_feed_response_content import GetFeedResponseContent
|
|
48
|
+
from creatorsapi_python_sdk.models.get_items_request_content import GetItemsRequestContent
|
|
49
|
+
from creatorsapi_python_sdk.models.get_items_resource import GetItemsResource
|
|
50
|
+
from creatorsapi_python_sdk.models.get_items_response_content import GetItemsResponseContent
|
|
51
|
+
from creatorsapi_python_sdk.models.get_report_request_content import GetReportRequestContent
|
|
52
|
+
from creatorsapi_python_sdk.models.get_report_response_content import GetReportResponseContent
|
|
53
|
+
from creatorsapi_python_sdk.models.get_variations_request_content import GetVariationsRequestContent
|
|
54
|
+
from creatorsapi_python_sdk.models.get_variations_resource import GetVariationsResource
|
|
55
|
+
from creatorsapi_python_sdk.models.get_variations_response_content import GetVariationsResponseContent
|
|
56
|
+
from creatorsapi_python_sdk.models.image_size import ImageSize
|
|
57
|
+
from creatorsapi_python_sdk.models.image_type import ImageType
|
|
58
|
+
from creatorsapi_python_sdk.models.images import Images
|
|
59
|
+
from creatorsapi_python_sdk.models.internal_server_exception_response_content import InternalServerExceptionResponseContent
|
|
60
|
+
from creatorsapi_python_sdk.models.item import Item
|
|
61
|
+
from creatorsapi_python_sdk.models.item_info import ItemInfo
|
|
62
|
+
from creatorsapi_python_sdk.models.items_result import ItemsResult
|
|
63
|
+
from creatorsapi_python_sdk.models.language_type import LanguageType
|
|
64
|
+
from creatorsapi_python_sdk.models.languages import Languages
|
|
65
|
+
from creatorsapi_python_sdk.models.list_feeds_response_content import ListFeedsResponseContent
|
|
66
|
+
from creatorsapi_python_sdk.models.list_reports_response_content import ListReportsResponseContent
|
|
67
|
+
from creatorsapi_python_sdk.models.manufacture_info import ManufactureInfo
|
|
68
|
+
from creatorsapi_python_sdk.models.money import Money
|
|
69
|
+
from creatorsapi_python_sdk.models.multi_valued_attribute import MultiValuedAttribute
|
|
70
|
+
from creatorsapi_python_sdk.models.offer_availability_v2 import OfferAvailabilityV2
|
|
71
|
+
from creatorsapi_python_sdk.models.offer_condition_v2 import OfferConditionV2
|
|
72
|
+
from creatorsapi_python_sdk.models.offer_listing_v2 import OfferListingV2
|
|
73
|
+
from creatorsapi_python_sdk.models.offer_loyalty_points_v2 import OfferLoyaltyPointsV2
|
|
74
|
+
from creatorsapi_python_sdk.models.offer_merchant_info_v2 import OfferMerchantInfoV2
|
|
75
|
+
from creatorsapi_python_sdk.models.offer_price_v2 import OfferPriceV2
|
|
76
|
+
from creatorsapi_python_sdk.models.offer_saving_basis import OfferSavingBasis
|
|
77
|
+
from creatorsapi_python_sdk.models.offer_savings import OfferSavings
|
|
78
|
+
from creatorsapi_python_sdk.models.offer_type import OfferType
|
|
79
|
+
from creatorsapi_python_sdk.models.offers_v2 import OffersV2
|
|
80
|
+
from creatorsapi_python_sdk.models.product_info import ProductInfo
|
|
81
|
+
from creatorsapi_python_sdk.models.rating import Rating
|
|
82
|
+
from creatorsapi_python_sdk.models.refinement import Refinement
|
|
83
|
+
from creatorsapi_python_sdk.models.refinement_bin import RefinementBin
|
|
84
|
+
from creatorsapi_python_sdk.models.report_metadata import ReportMetadata
|
|
85
|
+
from creatorsapi_python_sdk.models.resource_not_found_exception_response_content import ResourceNotFoundExceptionResponseContent
|
|
86
|
+
from creatorsapi_python_sdk.models.saving_basis_type import SavingBasisType
|
|
87
|
+
from creatorsapi_python_sdk.models.search_items_request_content import SearchItemsRequestContent
|
|
88
|
+
from creatorsapi_python_sdk.models.search_items_resource import SearchItemsResource
|
|
89
|
+
from creatorsapi_python_sdk.models.search_items_response_content import SearchItemsResponseContent
|
|
90
|
+
from creatorsapi_python_sdk.models.search_refinements import SearchRefinements
|
|
91
|
+
from creatorsapi_python_sdk.models.search_result import SearchResult
|
|
92
|
+
from creatorsapi_python_sdk.models.single_boolean_valued_attribute import SingleBooleanValuedAttribute
|
|
93
|
+
from creatorsapi_python_sdk.models.single_integer_valued_attribute import SingleIntegerValuedAttribute
|
|
94
|
+
from creatorsapi_python_sdk.models.single_string_valued_attribute import SingleStringValuedAttribute
|
|
95
|
+
from creatorsapi_python_sdk.models.sort_by import SortBy
|
|
96
|
+
from creatorsapi_python_sdk.models.technical_info import TechnicalInfo
|
|
97
|
+
from creatorsapi_python_sdk.models.throttle_exception_response_content import ThrottleExceptionResponseContent
|
|
98
|
+
from creatorsapi_python_sdk.models.trade_in_info import TradeInInfo
|
|
99
|
+
from creatorsapi_python_sdk.models.trade_in_price import TradeInPrice
|
|
100
|
+
from creatorsapi_python_sdk.models.unauthorized_exception_reason import UnauthorizedExceptionReason
|
|
101
|
+
from creatorsapi_python_sdk.models.unauthorized_exception_response_content import UnauthorizedExceptionResponseContent
|
|
102
|
+
from creatorsapi_python_sdk.models.unit_based_attribute import UnitBasedAttribute
|
|
103
|
+
from creatorsapi_python_sdk.models.validation_exception_field import ValidationExceptionField
|
|
104
|
+
from creatorsapi_python_sdk.models.validation_exception_reason import ValidationExceptionReason
|
|
105
|
+
from creatorsapi_python_sdk.models.validation_exception_response_content import ValidationExceptionResponseContent
|
|
106
|
+
from creatorsapi_python_sdk.models.variation_attribute import VariationAttribute
|
|
107
|
+
from creatorsapi_python_sdk.models.variation_dimension import VariationDimension
|
|
108
|
+
from creatorsapi_python_sdk.models.variation_summary import VariationSummary
|
|
109
|
+
from creatorsapi_python_sdk.models.variation_summary_price import VariationSummaryPrice
|
|
110
|
+
from creatorsapi_python_sdk.models.variations_result import VariationsResult
|
|
111
|
+
from creatorsapi_python_sdk.models.website_sales_rank import WebsiteSalesRank
|