python-amazon-sp-api 1.9.34__py3-none-any.whl → 2.0.7__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.
- {python_amazon_sp_api-1.9.34.dist-info → python_amazon_sp_api-2.0.7.dist-info}/METADATA +44 -20
- python_amazon_sp_api-2.0.7.dist-info/RECORD +251 -0
- {python_amazon_sp_api-1.9.34.dist-info → python_amazon_sp_api-2.0.7.dist-info}/top_level.txt +0 -1
- sp_api/__version__.py +1 -1
- sp_api/api/__init__.py +5 -2
- sp_api/api/application_integrations/application_integrations.py +2 -2
- sp_api/api/catalog/catalog.py +3 -4
- sp_api/api/catalog_items/catalog_items.py +3 -6
- sp_api/api/customer_feedback/customer_feedback.py +110 -0
- sp_api/api/data_kiosk/data_kiosk.py +5 -6
- sp_api/api/easy_ship/easy_ship.py +5 -5
- sp_api/api/external_fulfillment/external_fulfillment.py +706 -0
- sp_api/api/feeds/feeds.py +11 -8
- sp_api/api/fulfillment_inbound/fulfillment_inbound.py +35 -2
- sp_api/api/inventories/inventories.py +2 -7
- sp_api/api/listings_items/listings_items.py +3 -24
- sp_api/api/messaging/messaging.py +42 -0
- sp_api/api/orders/orders.py +7 -0
- sp_api/api/product_fees/product_fees.py +31 -74
- sp_api/api/products/products.py +3 -1
- sp_api/api/products/products_definitions.py +11 -169
- sp_api/api/reports/reports.py +61 -96
- sp_api/api/sales/sales.py +2 -2
- sp_api/asyncio/api/__init__.py +164 -0
- sp_api/asyncio/api/amazon_warehousing_and_distribu/__init__.py +9 -0
- sp_api/asyncio/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +130 -0
- sp_api/asyncio/api/aplus_content/__init__.py +5 -0
- sp_api/asyncio/api/aplus_content/aplus_content.py +330 -0
- sp_api/asyncio/api/application_integrations/__init__.py +5 -0
- sp_api/asyncio/api/application_integrations/application_integrations.py +119 -0
- sp_api/asyncio/api/application_management/__init__.py +5 -0
- sp_api/asyncio/api/application_management/application_management.py +36 -0
- sp_api/asyncio/api/authorization/__init__.py +5 -0
- sp_api/asyncio/api/authorization/authorization.py +54 -0
- sp_api/asyncio/api/catalog/__init__.py +5 -0
- sp_api/asyncio/api/catalog/catalog.py +111 -0
- sp_api/asyncio/api/catalog_items/__init__.py +6 -0
- sp_api/asyncio/api/catalog_items/catalog_items.py +93 -0
- sp_api/asyncio/api/clients/__init__.py +1 -0
- sp_api/asyncio/api/customer_feedback/__init__.py +5 -0
- sp_api/asyncio/api/customer_feedback/customer_feedback.py +111 -0
- sp_api/asyncio/api/data_kiosk/__init__.py +5 -0
- sp_api/asyncio/api/data_kiosk/data_kiosk.py +236 -0
- sp_api/asyncio/api/easy_ship/__init__.py +5 -0
- sp_api/asyncio/api/easy_ship/easy_ship.py +191 -0
- sp_api/asyncio/api/external_fulfillment/__init__.py +5 -0
- sp_api/asyncio/api/external_fulfillment/external_fulfillment.py +706 -0
- sp_api/asyncio/api/fba_inbound_eligibility/__init__.py +5 -0
- sp_api/asyncio/api/fba_inbound_eligibility/fba_inbound_eligibility.py +96 -0
- sp_api/asyncio/api/fba_small_and_light/__init__.py +5 -0
- sp_api/asyncio/api/fba_small_and_light/fba_small_and_light.py +213 -0
- sp_api/asyncio/api/feeds/feeds.py +260 -0
- sp_api/asyncio/api/finances/finances.py +100 -0
- sp_api/asyncio/api/fulfillment_inbound/fulfillment_inbound.py +1798 -0
- sp_api/asyncio/api/fulfillment_outbound/fulfillment_outbound.py +736 -0
- sp_api/asyncio/api/inventories/inventories.py +74 -0
- sp_api/asyncio/api/listings_items/listings_items.py +170 -0
- sp_api/asyncio/api/listings_restrictions/listings_restrictions.py +36 -0
- sp_api/asyncio/api/merchant_fulfillment/__init__.py +0 -0
- sp_api/asyncio/api/merchant_fulfillment/merchant_fulfillment.py +384 -0
- sp_api/asyncio/api/messaging/__init__.py +0 -0
- sp_api/asyncio/api/messaging/messaging.py +511 -0
- sp_api/asyncio/api/models/__init__.py +4 -0
- sp_api/asyncio/api/notifications/__init__.py +0 -0
- sp_api/asyncio/api/notifications/notifications.py +295 -0
- sp_api/asyncio/api/orders/__init__.py +0 -0
- sp_api/asyncio/api/orders/orders.py +362 -0
- sp_api/asyncio/api/overrides/__init__.py +1 -0
- sp_api/asyncio/api/product_fees/__init__.py +0 -0
- sp_api/asyncio/api/product_fees/product_fees.py +194 -0
- sp_api/asyncio/api/product_type_definitions/__init__.py +0 -0
- sp_api/asyncio/api/product_type_definitions/product_type_definitions.py +75 -0
- sp_api/asyncio/api/products/__init__.py +0 -0
- sp_api/asyncio/api/products/products.py +405 -0
- sp_api/asyncio/api/products/products_definitions.py +11 -0
- sp_api/asyncio/api/replenishment/__init__.py +0 -0
- sp_api/asyncio/api/replenishment/replenishment.py +121 -0
- sp_api/asyncio/api/reports/__init__.py +0 -0
- sp_api/asyncio/api/reports/reports.py +439 -0
- sp_api/asyncio/api/sales/__init__.py +0 -0
- sp_api/asyncio/api/sales/sales.py +93 -0
- sp_api/asyncio/api/sellers/__init__.py +0 -0
- sp_api/asyncio/api/sellers/sellers.py +70 -0
- sp_api/asyncio/api/services/__init__.py +0 -0
- sp_api/asyncio/api/services/services.py +218 -0
- sp_api/asyncio/api/shipping/__init__.py +0 -0
- sp_api/asyncio/api/shipping/shipping.py +459 -0
- sp_api/asyncio/api/shipping/shippingV2.py +651 -0
- sp_api/asyncio/api/solicitations/__init__.py +0 -0
- sp_api/asyncio/api/solicitations/solicitations.py +78 -0
- sp_api/asyncio/api/supply_sources/__init__.py +0 -0
- sp_api/asyncio/api/supply_sources/supply_sources.py +138 -0
- sp_api/asyncio/api/tokens/__init__.py +0 -0
- sp_api/asyncio/api/tokens/tokens.py +65 -0
- sp_api/asyncio/api/upload/__init__.py +0 -0
- sp_api/asyncio/api/upload/upload.py +18 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_inventory/__init__.py +0 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +64 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_orders/__init__.py +0 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +196 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_payments/__init__.py +0 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +254 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_shipping/__init__.py +0 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +627 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_transactions/__init__.py +0 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +43 -0
- sp_api/asyncio/api/vendor_invoices/__init__.py +0 -0
- sp_api/asyncio/api/vendor_invoices/vendor_invoices.py +295 -0
- sp_api/asyncio/api/vendor_orders/__init__.py +0 -0
- sp_api/asyncio/api/vendor_orders/vendor_orders.py +210 -0
- sp_api/asyncio/api/vendor_shipments/__init__.py +0 -0
- sp_api/asyncio/api/vendor_shipments/vendor_shipments.py +118 -0
- sp_api/asyncio/api/vendor_transaction_status/__init__.py +0 -0
- sp_api/asyncio/api/vendor_transaction_status/vendor_transaction_status.py +41 -0
- sp_api/asyncio/auth/__init__.py +12 -0
- sp_api/asyncio/auth/access_token_client.py +145 -0
- sp_api/asyncio/auth/exceptions.py +5 -0
- sp_api/asyncio/base/__init__.py +53 -0
- sp_api/asyncio/base/_transport_httpx.py +50 -0
- sp_api/asyncio/base/base_client.py +8 -0
- sp_api/asyncio/base/client.py +169 -0
- sp_api/asyncio/util/__init__.py +29 -0
- sp_api/asyncio/util/key_maker.py +5 -0
- sp_api/asyncio/util/load_all_pages.py +55 -0
- sp_api/asyncio/util/load_date_bound.py +53 -0
- sp_api/asyncio/util/retry.py +88 -0
- sp_api/auth/_core.py +39 -0
- sp_api/auth/access_token_client.py +18 -29
- sp_api/base/ApiResponse.py +2 -2
- sp_api/base/_core.py +110 -0
- sp_api/base/_transport_httpx.py +39 -0
- sp_api/base/client.py +40 -63
- sp_api/base/helpers.py +1 -1
- sp_api/base/reportTypes.py +3 -2
- sp_api/util/__init__.py +36 -0
- sp_api/util/params.py +57 -0
- sp_api/util/product_fees.py +40 -0
- sp_api/util/products_definitions.py +169 -0
- sp_api/util/report_document.py +154 -0
- python_amazon_sp_api-1.9.34.dist-info/RECORD +0 -148
- tests/api/finances/test_finances.py +0 -19
- tests/api/notifications/test_notifications.py +0 -26
- tests/api/orders/test_orders.py +0 -122
- tests/api/product_fees/product_fees.py +0 -49
- tests/api/reports/test_reports.py +0 -127
- tests/client/test_auth.py +0 -59
- tests/client/test_base.py +0 -163
- tests/client/test_credential_provider.py +0 -45
- tests/client/test_helpers.py +0 -142
- {python_amazon_sp_api-1.9.34.data → python_amazon_sp_api-2.0.7.data}/scripts/make_endpoint +0 -0
- {python_amazon_sp_api-1.9.34.dist-info → python_amazon_sp_api-2.0.7.dist-info}/WHEEL +0 -0
- {python_amazon_sp_api-1.9.34.dist-info → python_amazon_sp_api-2.0.7.dist-info}/licenses/LICENSE +0 -0
- {tests → sp_api/api/customer_feedback}/__init__.py +0 -0
- {tests/api → sp_api/api/external_fulfillment}/__init__.py +0 -0
- {tests/api/finances → sp_api/asyncio}/__init__.py +0 -0
- {tests/api/notifications → sp_api/asyncio/api/feeds}/__init__.py +0 -0
- {tests/api/orders → sp_api/asyncio/api/finances}/__init__.py +0 -0
- {tests/api/product_fees → sp_api/asyncio/api/fulfillment_inbound}/__init__.py +0 -0
- {tests/api/reports → sp_api/asyncio/api/fulfillment_outbound}/__init__.py +0 -0
- {tests/api/sellers → sp_api/asyncio/api/inventories}/__init__.py +0 -0
- {tests/client → sp_api/asyncio/api/listings_items}/__init__.py +0 -0
- /tests/api/sellers/test_sellers.py → /sp_api/asyncio/api/listings_restrictions/__init__.py +0 -0
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
from sp_api.base.helpers import sp_endpoint, fill_query_params
|
|
2
|
+
from sp_api.base import Client, Marketplaces, deprecated, NotificationType, ApiResponse
|
|
3
|
+
from sp_api.asyncio.base import AsyncBaseClient
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Notifications(AsyncBaseClient):
|
|
7
|
+
"""
|
|
8
|
+
:link: https://github.com/amzn/selling-partner-api-docs/blob/main/references/notifications-api/notifications.md
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
grantless_scope = "sellingpartnerapi::notifications"
|
|
12
|
+
|
|
13
|
+
@deprecated
|
|
14
|
+
async def add_subscription(self, notification_type: NotificationType or str, **kwargs):
|
|
15
|
+
"""deprecated, use create_subscription"""
|
|
16
|
+
return self.create_subscription(notification_type, **kwargs)
|
|
17
|
+
|
|
18
|
+
@sp_endpoint("/notifications/v1/subscriptions/{}", method="POST")
|
|
19
|
+
async def create_subscription(
|
|
20
|
+
self,
|
|
21
|
+
notification_type: NotificationType or str,
|
|
22
|
+
destination_id: str = None,
|
|
23
|
+
**kwargs
|
|
24
|
+
) -> ApiResponse:
|
|
25
|
+
"""
|
|
26
|
+
create_subscription(self, notification_type: NotificationType or str, destination_id: str = None, **kwargs) -> ApiResponse
|
|
27
|
+
Creates a subscription for the specified notification type to be delivered to the specified destination.
|
|
28
|
+
Before you can subscribe, you must first create the destination by calling the createDestination operation.
|
|
29
|
+
|
|
30
|
+
**Usage Plan:**
|
|
31
|
+
|
|
32
|
+
====================================== ==============
|
|
33
|
+
Rate (requests per second) Burst
|
|
34
|
+
====================================== ==============
|
|
35
|
+
1 5
|
|
36
|
+
====================================== ==============
|
|
37
|
+
|
|
38
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
39
|
+
|
|
40
|
+
Examples:
|
|
41
|
+
literal blocks::
|
|
42
|
+
|
|
43
|
+
Notifications().create_subscription(NotificationType.MFN_ORDER_STATUS_CHANGE, destination_id='dest_id')
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
notification_type: NotificationType or str
|
|
47
|
+
destination_id: str
|
|
48
|
+
**kwargs:
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
ApiResponse:
|
|
53
|
+
|
|
54
|
+
"""
|
|
55
|
+
data = {
|
|
56
|
+
"destinationId": kwargs.pop("destinationId", destination_id),
|
|
57
|
+
"payloadVersion": kwargs.pop("payload_version", "1.0"),
|
|
58
|
+
}
|
|
59
|
+
return await self._request(
|
|
60
|
+
fill_query_params(
|
|
61
|
+
kwargs.pop("path"),
|
|
62
|
+
(
|
|
63
|
+
notification_type
|
|
64
|
+
if isinstance(notification_type, str)
|
|
65
|
+
else notification_type.value
|
|
66
|
+
),
|
|
67
|
+
),
|
|
68
|
+
data={**kwargs, **data},
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
@sp_endpoint("/notifications/v1/subscriptions/{}")
|
|
72
|
+
async def get_subscription(
|
|
73
|
+
self, notification_type: NotificationType or str, **kwargs
|
|
74
|
+
) -> ApiResponse:
|
|
75
|
+
"""
|
|
76
|
+
get_subscription(self, notification_type: NotificationType or str, **kwargs) -> ApiResponse
|
|
77
|
+
Returns information about subscriptions of the specified notification type. You can use this API to get subscription information when you do not have a subscription identifier.
|
|
78
|
+
|
|
79
|
+
**Usage Plan:**
|
|
80
|
+
|
|
81
|
+
====================================== ==============
|
|
82
|
+
Rate (requests per second) Burst
|
|
83
|
+
====================================== ==============
|
|
84
|
+
1 5
|
|
85
|
+
====================================== ==============
|
|
86
|
+
|
|
87
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
88
|
+
|
|
89
|
+
Examples:
|
|
90
|
+
literal blocks::
|
|
91
|
+
|
|
92
|
+
Notifications().get_subscription(NotificationType.REPORT_PROCESSING_FINISHED)
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
notification_type: NotificationType or str
|
|
96
|
+
**kwargs:
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
ApiResponse:
|
|
100
|
+
|
|
101
|
+
"""
|
|
102
|
+
return await self._request(
|
|
103
|
+
fill_query_params(
|
|
104
|
+
kwargs.pop("path"),
|
|
105
|
+
(
|
|
106
|
+
notification_type
|
|
107
|
+
if isinstance(notification_type, str)
|
|
108
|
+
else notification_type.value
|
|
109
|
+
),
|
|
110
|
+
),
|
|
111
|
+
params={**kwargs},
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
@sp_endpoint("/notifications/v1/subscriptions/{}/{}", method="DELETE")
|
|
115
|
+
async def delete_notification_subscription(
|
|
116
|
+
self, notification_type: NotificationType or str, subscription_id: str, **kwargs
|
|
117
|
+
) -> ApiResponse:
|
|
118
|
+
"""
|
|
119
|
+
delete_notification_subscription(self, notification_type: NotificationType or str, subscription_id: str, **kwargs) -> ApiResponse
|
|
120
|
+
Deletes the subscription indicated by the subscription identifier and notification type that you specify.
|
|
121
|
+
The subscription identifier can be for any subscription associated with your application. After you successfully call this operation, notifications will stop being sent for the associated subscription. The deleteSubscriptionById API is grantless. For more information, see "Grantless operations" in the Selling Partner API Developer Guide.
|
|
122
|
+
|
|
123
|
+
**Usage Plan:**
|
|
124
|
+
|
|
125
|
+
====================================== ==============
|
|
126
|
+
Rate (requests per second) Burst
|
|
127
|
+
====================================== ==============
|
|
128
|
+
1 5
|
|
129
|
+
====================================== ==============
|
|
130
|
+
|
|
131
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
132
|
+
|
|
133
|
+
Examples:
|
|
134
|
+
Notifications().delete_notification_subscription(NotificationType.MFN_ORDER_STATUS_CHANGE, 'subscription_id')
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
notification_type: NotificationType or str
|
|
138
|
+
subscription_id: str
|
|
139
|
+
**kwargs:
|
|
140
|
+
|
|
141
|
+
Returns:
|
|
142
|
+
ApiResponse:
|
|
143
|
+
|
|
144
|
+
"""
|
|
145
|
+
return await self._request(
|
|
146
|
+
fill_query_params(
|
|
147
|
+
kwargs.pop("path"),
|
|
148
|
+
(
|
|
149
|
+
notification_type
|
|
150
|
+
if isinstance(notification_type, str)
|
|
151
|
+
else notification_type.value
|
|
152
|
+
),
|
|
153
|
+
subscription_id,
|
|
154
|
+
),
|
|
155
|
+
params={**kwargs},
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
@sp_endpoint(path="/notifications/v1/destinations", method="POST")
|
|
159
|
+
async def create_destination(
|
|
160
|
+
self,
|
|
161
|
+
name: str,
|
|
162
|
+
arn: str = None,
|
|
163
|
+
account_id: str = None,
|
|
164
|
+
region: str = None,
|
|
165
|
+
**kwargs
|
|
166
|
+
) -> ApiResponse:
|
|
167
|
+
"""
|
|
168
|
+
create_destination(self, name: str, arn: str, **kwargs) -> ApiResponse
|
|
169
|
+
Creates a destination resource to receive notifications. The createDestination API is grantless. For more information, see "Grantless operations" in the Selling Partner API Developer Guide.
|
|
170
|
+
|
|
171
|
+
**Usage Plan:**
|
|
172
|
+
|
|
173
|
+
====================================== ==============
|
|
174
|
+
Rate (requests per second) Burst
|
|
175
|
+
====================================== ==============
|
|
176
|
+
1 5
|
|
177
|
+
====================================== ==============
|
|
178
|
+
|
|
179
|
+
Examples:
|
|
180
|
+
literal blocks::
|
|
181
|
+
|
|
182
|
+
Notifications().create_destination(name='test', arn='arn:aws:sqs:us-east-2:444455556666:queue1')
|
|
183
|
+
|
|
184
|
+
Args:
|
|
185
|
+
account_id:
|
|
186
|
+
region:
|
|
187
|
+
name: str
|
|
188
|
+
arn: str
|
|
189
|
+
**kwargs:
|
|
190
|
+
|
|
191
|
+
Returns:
|
|
192
|
+
ApiResponse:
|
|
193
|
+
|
|
194
|
+
"""
|
|
195
|
+
resource_name = "sqs" if not account_id else "eventBridge"
|
|
196
|
+
region = region if region else self.region
|
|
197
|
+
|
|
198
|
+
data = {
|
|
199
|
+
"resourceSpecification": {
|
|
200
|
+
resource_name: (
|
|
201
|
+
{"arn": arn}
|
|
202
|
+
if not account_id
|
|
203
|
+
else {"region": region, "accountId": account_id}
|
|
204
|
+
)
|
|
205
|
+
},
|
|
206
|
+
"name": name,
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return await self._request_grantless_operation(
|
|
210
|
+
kwargs.pop("path"), data={**kwargs, **data}
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
@sp_endpoint("/notifications/v1/destinations", method="GET")
|
|
214
|
+
async def get_destinations(self, **kwargs) -> ApiResponse:
|
|
215
|
+
"""
|
|
216
|
+
get_destinations(self, **kwargs) -> ApiResponse
|
|
217
|
+
Returns information about all destinations. The getDestinations API is grantless. For more information, see "Grantless operations" in the Selling Partner API Developer Guide.
|
|
218
|
+
|
|
219
|
+
**Usage Plan:**
|
|
220
|
+
|
|
221
|
+
====================================== ==============
|
|
222
|
+
Rate (requests per second) Burst
|
|
223
|
+
====================================== ==============
|
|
224
|
+
1 5
|
|
225
|
+
====================================== ==============
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
229
|
+
|
|
230
|
+
Args:
|
|
231
|
+
**kwargs:
|
|
232
|
+
|
|
233
|
+
Returns:
|
|
234
|
+
ApiResponse:
|
|
235
|
+
|
|
236
|
+
"""
|
|
237
|
+
return await self._request_grantless_operation(kwargs.pop("path"), params={**kwargs})
|
|
238
|
+
|
|
239
|
+
@sp_endpoint("/notifications/v1/destinations/{}", method="GET")
|
|
240
|
+
async def get_destination(self, destination_id: str, **kwargs) -> ApiResponse:
|
|
241
|
+
"""
|
|
242
|
+
get_destination(self, destination_id: str, **kwargs) -> ApiResponse
|
|
243
|
+
Returns information about all destinations. The getDestinations API is grantless. For more information, see "Grantless operations" in the Selling Partner API Developer Guide.
|
|
244
|
+
|
|
245
|
+
**Usage Plan:**
|
|
246
|
+
|
|
247
|
+
====================================== ==============
|
|
248
|
+
Rate (requests per second) Burst
|
|
249
|
+
====================================== ==============
|
|
250
|
+
1 5
|
|
251
|
+
====================================== ==============
|
|
252
|
+
|
|
253
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
Args:
|
|
257
|
+
destination_id: str
|
|
258
|
+
**kwargs:
|
|
259
|
+
|
|
260
|
+
Returns:
|
|
261
|
+
ApiResponse:
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
"""
|
|
265
|
+
return await self._request_grantless_operation(
|
|
266
|
+
fill_query_params(kwargs.pop("path"), destination_id), params={**kwargs}
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
@sp_endpoint("/notifications/v1/destinations/{}", method="DELETE")
|
|
270
|
+
async def delete_destination(self, destination_id: str, **kwargs) -> ApiResponse:
|
|
271
|
+
"""
|
|
272
|
+
delete_destination(self, destination_id: str, **kwargs) -> ApiResponse
|
|
273
|
+
Deletes the destination that you specify. The deleteDestination API is grantless. For more information, see "Grantless operations" in the Selling Partner API Developer Guide.
|
|
274
|
+
|
|
275
|
+
**Usage Plan:**
|
|
276
|
+
|
|
277
|
+
====================================== ==============
|
|
278
|
+
Rate (requests per second) Burst
|
|
279
|
+
====================================== ==============
|
|
280
|
+
1 5
|
|
281
|
+
====================================== ==============
|
|
282
|
+
|
|
283
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
284
|
+
|
|
285
|
+
Args:
|
|
286
|
+
destination_id: str
|
|
287
|
+
**kwargs:
|
|
288
|
+
|
|
289
|
+
Returns:
|
|
290
|
+
ApiResponse:
|
|
291
|
+
|
|
292
|
+
"""
|
|
293
|
+
return await self._request_grantless_operation(
|
|
294
|
+
fill_query_params(kwargs.pop("path"), destination_id), params={**kwargs}
|
|
295
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
from sp_api.base import sp_endpoint, fill_query_params, ApiResponse, deprecated
|
|
2
|
+
from sp_api.asyncio.base import AsyncBaseClient
|
|
3
|
+
from sp_api.util import normalize_csv_param
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Orders(AsyncBaseClient):
|
|
7
|
+
"""
|
|
8
|
+
:link: https://github.com/amzn/selling-partner-api-docs/tree/main/references/orders-api
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
@sp_endpoint("/orders/v0/orders")
|
|
12
|
+
async def get_orders(self, **kwargs) -> ApiResponse:
|
|
13
|
+
"""
|
|
14
|
+
get_orders(self, **kwargs) -> ApiResponse
|
|
15
|
+
Returns orders created or updated during the time frame indicated by the specified parameters.
|
|
16
|
+
You can also apply a range of filtering criteria to narrow the list of orders returned.
|
|
17
|
+
If NextToken is present, that will be used to retrieve the orders instead of other criteria.
|
|
18
|
+
|
|
19
|
+
**Usage Plan:**
|
|
20
|
+
|
|
21
|
+
====================================== ==============
|
|
22
|
+
Rate (requests per second) Burst
|
|
23
|
+
====================================== ==============
|
|
24
|
+
1 1
|
|
25
|
+
====================================== ==============
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
29
|
+
|
|
30
|
+
Examples:
|
|
31
|
+
literal blocks::
|
|
32
|
+
|
|
33
|
+
Orders().get_orders(CreatedAfter='TEST_CASE_200', MarketplaceIds=["ATVPDKIKX0DER"])
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
key CreatedAfter: date
|
|
37
|
+
key CreatedBefore: date
|
|
38
|
+
key LastUpdatedAfter: date
|
|
39
|
+
key LastUpdatedBefore: date
|
|
40
|
+
key OrderStatuses: [str]
|
|
41
|
+
key MarketplaceIds: [str]
|
|
42
|
+
key FulfillmentChannels: [str]
|
|
43
|
+
key PaymentMethods: [str]
|
|
44
|
+
key BuyerEmail: str
|
|
45
|
+
key SellerOrderId: str
|
|
46
|
+
key MaxResultsPerPage: int
|
|
47
|
+
key EasyShipShipmentStatuses: [str]
|
|
48
|
+
key NextToken: str
|
|
49
|
+
key AmazonOrderIds: [str]
|
|
50
|
+
key RestrictedResources: [str]
|
|
51
|
+
|
|
52
|
+
Returns:
|
|
53
|
+
ApiResponse:
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
"""
|
|
57
|
+
normalize_csv_param(kwargs, "OrderStatuses")
|
|
58
|
+
normalize_csv_param(kwargs, "MarketplaceIds")
|
|
59
|
+
normalize_csv_param(kwargs, "FulfillmentChannels")
|
|
60
|
+
normalize_csv_param(kwargs, "PaymentMethods")
|
|
61
|
+
normalize_csv_param(kwargs, "AmazonOrderIds")
|
|
62
|
+
|
|
63
|
+
if "RestrictedResources" in kwargs:
|
|
64
|
+
return self._access_restricted(kwargs)
|
|
65
|
+
return await self._request(kwargs.pop("path"), params={**kwargs})
|
|
66
|
+
|
|
67
|
+
@sp_endpoint("/orders/v0/orders/{}")
|
|
68
|
+
async def get_order(self, order_id: str, **kwargs) -> ApiResponse:
|
|
69
|
+
"""
|
|
70
|
+
get_order(self, order_id: str, **kwargs) -> ApiResponse
|
|
71
|
+
Returns the order indicated by the specified order ID.
|
|
72
|
+
|
|
73
|
+
**Usage Plan:**
|
|
74
|
+
|
|
75
|
+
====================================== ==============
|
|
76
|
+
Rate (requests per second) Burst
|
|
77
|
+
====================================== ==============
|
|
78
|
+
1 1
|
|
79
|
+
====================================== ==============
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
83
|
+
|
|
84
|
+
Examples:
|
|
85
|
+
literal blocks::
|
|
86
|
+
|
|
87
|
+
Orders().get_order('TEST_CASE_200')
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
order_id: str
|
|
91
|
+
key RestrictedResources: [str]
|
|
92
|
+
**kwargs:
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
ApiResponse:
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
"""
|
|
99
|
+
if "RestrictedResources" in kwargs:
|
|
100
|
+
kwargs.update(
|
|
101
|
+
{"original_path": fill_query_params(kwargs.get("path"), order_id)}
|
|
102
|
+
)
|
|
103
|
+
return self._access_restricted(kwargs)
|
|
104
|
+
return await self._request(
|
|
105
|
+
fill_query_params(kwargs.pop("path"), order_id),
|
|
106
|
+
params={**kwargs},
|
|
107
|
+
add_marketplace=False,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
@sp_endpoint("/orders/v0/orders/{}/orderItems")
|
|
111
|
+
async def get_order_items(self, order_id: str, **kwargs) -> ApiResponse:
|
|
112
|
+
"""
|
|
113
|
+
get_order_items(self, order_id: str, **kwargs) -> ApiResponse
|
|
114
|
+
|
|
115
|
+
Returns detailed order item information for the order indicated by the specified order ID.
|
|
116
|
+
If NextToken is provided, it's used to retrieve the next page of order items.
|
|
117
|
+
|
|
118
|
+
Note: When an order is in the Pending state (the order has been placed but payment has not been authorized),
|
|
119
|
+
the getOrderItems operation does not return information about pricing, taxes, shipping charges, gift status or
|
|
120
|
+
promotions for the order items in the order.
|
|
121
|
+
After an order leaves the Pending state (this occurs when payment has been authorized) and enters the Unshipped,
|
|
122
|
+
Partially Shipped, or Shipped state, the getOrderItems operation returns information about pricing, taxes,
|
|
123
|
+
shipping charges, gift status and promotions for the order items in the order.
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
**Usage Plan:**
|
|
127
|
+
|
|
128
|
+
====================================== ==============
|
|
129
|
+
Rate (requests per second) Burst
|
|
130
|
+
====================================== ==============
|
|
131
|
+
1 1
|
|
132
|
+
====================================== ==============
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
137
|
+
|
|
138
|
+
Examples:
|
|
139
|
+
literal blocks::
|
|
140
|
+
|
|
141
|
+
Orders().get_order_items('TEST_CASE_200')
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
order_id: str
|
|
145
|
+
key RestrictedResources: [str]
|
|
146
|
+
**kwargs:
|
|
147
|
+
|
|
148
|
+
Returns:
|
|
149
|
+
ApiResponse:
|
|
150
|
+
|
|
151
|
+
"""
|
|
152
|
+
if "RestrictedResources" in kwargs:
|
|
153
|
+
kwargs.update(
|
|
154
|
+
{"original_path": fill_query_params(kwargs.get("path"), order_id)}
|
|
155
|
+
)
|
|
156
|
+
return self._access_restricted(kwargs)
|
|
157
|
+
return await self._request(
|
|
158
|
+
fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
@sp_endpoint("/orders/v0/orders/{}/address")
|
|
162
|
+
async def get_order_address(self, order_id, **kwargs) -> ApiResponse:
|
|
163
|
+
"""
|
|
164
|
+
get_order_address(self, order_id, **kwargs) -> ApiResponse
|
|
165
|
+
|
|
166
|
+
Returns the shipping address for the order indicated by the specified order ID.
|
|
167
|
+
|
|
168
|
+
:note: To get useful information from this method, you need to have access to PII.
|
|
169
|
+
|
|
170
|
+
**Usage Plan:**
|
|
171
|
+
|
|
172
|
+
====================================== ==============
|
|
173
|
+
Rate (requests per second) Burst
|
|
174
|
+
====================================== ==============
|
|
175
|
+
1 1
|
|
176
|
+
====================================== ==============
|
|
177
|
+
|
|
178
|
+
Examples:
|
|
179
|
+
Orders().get_order_address('TEST_CASE_200')
|
|
180
|
+
|
|
181
|
+
Args:
|
|
182
|
+
order_id: str
|
|
183
|
+
**kwargs:
|
|
184
|
+
|
|
185
|
+
Returns:
|
|
186
|
+
ApiResponse
|
|
187
|
+
"""
|
|
188
|
+
return await self._request(
|
|
189
|
+
fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
@sp_endpoint("/orders/v0/orders/{}/buyerInfo")
|
|
193
|
+
async def get_order_buyer_info(self, order_id: str, **kwargs) -> ApiResponse:
|
|
194
|
+
"""
|
|
195
|
+
get_order_buyer_info(self, order_id: str, **kwargs) -> ApiResponse
|
|
196
|
+
Returns buyer information for the order indicated by the specified order ID.
|
|
197
|
+
|
|
198
|
+
:note: To get useful information from this method, you need to have access to PII.
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
**Usage Plan:**
|
|
202
|
+
|
|
203
|
+
====================================== ==============
|
|
204
|
+
Rate (requests per second) Burst
|
|
205
|
+
====================================== ==============
|
|
206
|
+
1 1
|
|
207
|
+
====================================== ==============
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
211
|
+
|
|
212
|
+
Examples:
|
|
213
|
+
Orders().get_order_buyer_info('TEST_CASE_200')
|
|
214
|
+
|
|
215
|
+
Args:
|
|
216
|
+
order_id: str
|
|
217
|
+
**kwargs:
|
|
218
|
+
|
|
219
|
+
Returns:
|
|
220
|
+
GetOrderBuyerInfoResponse:
|
|
221
|
+
|
|
222
|
+
"""
|
|
223
|
+
return await self._request(
|
|
224
|
+
fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
@sp_endpoint("/orders/v0/orders/{}/orderItems/buyerInfo")
|
|
228
|
+
async def get_order_items_buyer_info(self, order_id: str, **kwargs) -> ApiResponse:
|
|
229
|
+
"""
|
|
230
|
+
get_order_items_buyer_info(self, order_id: str, **kwargs) -> ApiResponse
|
|
231
|
+
|
|
232
|
+
Returns buyer information in the order items of the order indicated by the specified order ID.
|
|
233
|
+
|
|
234
|
+
**Usage Plan:**
|
|
235
|
+
|
|
236
|
+
====================================== ==============
|
|
237
|
+
Rate (requests per second) Burst
|
|
238
|
+
====================================== ==============
|
|
239
|
+
1 1
|
|
240
|
+
====================================== ==============
|
|
241
|
+
|
|
242
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
243
|
+
|
|
244
|
+
Examples:
|
|
245
|
+
literal blocks::
|
|
246
|
+
|
|
247
|
+
Orders().get_order_items_buyer_info('TEST_CASE_200')
|
|
248
|
+
|
|
249
|
+
Args:
|
|
250
|
+
order_id: str
|
|
251
|
+
key NextToken: str | retrieve data by next token
|
|
252
|
+
|
|
253
|
+
Returns:
|
|
254
|
+
ApiResponse
|
|
255
|
+
"""
|
|
256
|
+
return await self._request(
|
|
257
|
+
fill_query_params(kwargs.pop("path"), order_id), params=kwargs
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
@sp_endpoint("/orders/v0/orders/{}/shipment", method="POST")
|
|
261
|
+
async def update_shipment_status(self, order_id: str, **kwargs) -> ApiResponse:
|
|
262
|
+
"""
|
|
263
|
+
update_shipment_status(self, order_id: str, **kwargs) -> ApiResponse
|
|
264
|
+
Update the shipment status.
|
|
265
|
+
**Usage Plan:**
|
|
266
|
+
====================================== ==============
|
|
267
|
+
Rate (requests per second) Burst
|
|
268
|
+
====================================== ==============
|
|
269
|
+
5 15
|
|
270
|
+
====================================== ==============
|
|
271
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
272
|
+
Examples:
|
|
273
|
+
literal blocks::
|
|
274
|
+
Orders().update_shipment_status(
|
|
275
|
+
order_id='123-1234567-1234567',
|
|
276
|
+
marketplaceId='ATVPDKIKX0DER',
|
|
277
|
+
shipmentStatus='ReadyForPickup'
|
|
278
|
+
)
|
|
279
|
+
Args:
|
|
280
|
+
order_id: str
|
|
281
|
+
Returns:
|
|
282
|
+
ApiResponse
|
|
283
|
+
"""
|
|
284
|
+
return await self._request(
|
|
285
|
+
fill_query_params(kwargs.pop("path"), order_id),
|
|
286
|
+
res_no_data=True,
|
|
287
|
+
data=kwargs,
|
|
288
|
+
)
|
|
289
|
+
|
|
290
|
+
@sp_endpoint("/orders/v0/orders/{}/shipmentConfirmation", method="POST")
|
|
291
|
+
async def confirm_shipment(self, order_id: str, **kwargs) -> ApiResponse:
|
|
292
|
+
"""
|
|
293
|
+
confirm_shipment(self, order_id: str, **kwargs) -> ApiResponse
|
|
294
|
+
Updates the shipment confirmation status for a specified order.
|
|
295
|
+
**Usage Plan:**
|
|
296
|
+
====================================== ==============
|
|
297
|
+
Rate (requests per second) Burst
|
|
298
|
+
====================================== ==============
|
|
299
|
+
2 10
|
|
300
|
+
====================================== ==============
|
|
301
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
302
|
+
Examples:
|
|
303
|
+
literal blocks::
|
|
304
|
+
Orders().confirm_shipment(
|
|
305
|
+
order_id='123-1234567-1234567',
|
|
306
|
+
marketplaceId='ATVPDKIKX0DER',
|
|
307
|
+
packageDetail={
|
|
308
|
+
'packageReferenceId': '0001',
|
|
309
|
+
'carrierCode': 'DHL',
|
|
310
|
+
"shippingMethod": 'Paket',
|
|
311
|
+
'trackingNumber': '1234567890',
|
|
312
|
+
'shipDate': '2023-03-19T12:00:00Z',
|
|
313
|
+
'orderItems': [
|
|
314
|
+
{
|
|
315
|
+
'orderItemId': '123456789',
|
|
316
|
+
'quantity': 1
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
'orderItemId': '2345678901',
|
|
320
|
+
'quantity': 2
|
|
321
|
+
},
|
|
322
|
+
]
|
|
323
|
+
}
|
|
324
|
+
)
|
|
325
|
+
Args:
|
|
326
|
+
order_id: str
|
|
327
|
+
Returns:
|
|
328
|
+
ApiResponse
|
|
329
|
+
"""
|
|
330
|
+
return await self._request(
|
|
331
|
+
fill_query_params(kwargs.pop("path"), order_id),
|
|
332
|
+
add_marketplace=False,
|
|
333
|
+
res_no_data=True,
|
|
334
|
+
data=kwargs,
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
@sp_endpoint("/tokens/2021-03-01/restrictedDataToken", method="POST")
|
|
338
|
+
async def _get_token(self, **kwargs):
|
|
339
|
+
data_elements = kwargs.pop("RestrictedResources")
|
|
340
|
+
|
|
341
|
+
restricted_resources = [
|
|
342
|
+
{
|
|
343
|
+
"method": "GET",
|
|
344
|
+
"path": kwargs.get("original_path"),
|
|
345
|
+
"dataElements": data_elements,
|
|
346
|
+
}
|
|
347
|
+
]
|
|
348
|
+
|
|
349
|
+
return await self._request(
|
|
350
|
+
kwargs.pop("path"),
|
|
351
|
+
data={"restrictedResources": restricted_resources, **kwargs},
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
async def _access_restricted(self, kwargs):
|
|
355
|
+
if "original_path" not in kwargs:
|
|
356
|
+
kwargs.update({"original_path": kwargs["path"]})
|
|
357
|
+
token = self._get_token(**kwargs).payload
|
|
358
|
+
self.restricted_data_token = token["restrictedDataToken"]
|
|
359
|
+
r = await self._request(kwargs.pop("original_path"), params={**kwargs})
|
|
360
|
+
if not self.keep_restricted_data_token:
|
|
361
|
+
self.restricted_data_token = None
|
|
362
|
+
return r
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|