python-amazon-sp-api 2.0.10__py3-none-any.whl → 2.0.11__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-2.0.10.dist-info → python_amazon_sp_api-2.0.11.dist-info}/METADATA +1 -1
- {python_amazon_sp_api-2.0.10.dist-info → python_amazon_sp_api-2.0.11.dist-info}/RECORD +15 -13
- sp_api/__version__.py +1 -1
- sp_api/api/__init__.py +2 -0
- sp_api/api/orders/orders.py +125 -386
- sp_api/api/orders/orders_2026_01_01.py +1 -1
- sp_api/api/orders/orders_v0.py +359 -0
- sp_api/asyncio/api/__init__.py +2 -0
- sp_api/asyncio/api/orders/orders.py +128 -388
- sp_api/asyncio/api/orders/orders_2026_01_01.py +79 -3
- sp_api/asyncio/api/orders/orders_v0.py +361 -0
- {python_amazon_sp_api-2.0.10.data → python_amazon_sp_api-2.0.11.data}/scripts/make_endpoint +0 -0
- {python_amazon_sp_api-2.0.10.dist-info → python_amazon_sp_api-2.0.11.dist-info}/WHEEL +0 -0
- {python_amazon_sp_api-2.0.10.dist-info → python_amazon_sp_api-2.0.11.dist-info}/licenses/LICENSE +0 -0
- {python_amazon_sp_api-2.0.10.dist-info → python_amazon_sp_api-2.0.11.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
from sp_api.base import Client, sp_endpoint, fill_query_params, ApiResponse
|
|
2
|
+
from sp_api.util import normalize_csv_param
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class OrdersV0(Client):
|
|
6
|
+
|
|
7
|
+
@sp_endpoint("/orders/v0/orders")
|
|
8
|
+
def get_orders(self, **kwargs) -> ApiResponse:
|
|
9
|
+
"""
|
|
10
|
+
get_orders(self, **kwargs) -> ApiResponse
|
|
11
|
+
Returns orders created or updated during the time frame indicated by the specified parameters.
|
|
12
|
+
You can also apply a range of filtering criteria to narrow the list of orders returned.
|
|
13
|
+
If NextToken is present, that will be used to retrieve the orders instead of other criteria.
|
|
14
|
+
|
|
15
|
+
**Usage Plan:**
|
|
16
|
+
|
|
17
|
+
====================================== ==============
|
|
18
|
+
Rate (requests per second) Burst
|
|
19
|
+
====================================== ==============
|
|
20
|
+
1 1
|
|
21
|
+
====================================== ==============
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
25
|
+
|
|
26
|
+
Examples:
|
|
27
|
+
literal blocks::
|
|
28
|
+
|
|
29
|
+
Orders().get_orders(CreatedAfter='TEST_CASE_200', MarketplaceIds=["ATVPDKIKX0DER"])
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
key CreatedAfter: date
|
|
33
|
+
key CreatedBefore: date
|
|
34
|
+
key LastUpdatedAfter: date
|
|
35
|
+
key LastUpdatedBefore: date
|
|
36
|
+
key OrderStatuses: [str]
|
|
37
|
+
key MarketplaceIds: [str]
|
|
38
|
+
key FulfillmentChannels: [str]
|
|
39
|
+
key PaymentMethods: [str]
|
|
40
|
+
key BuyerEmail: str
|
|
41
|
+
key SellerOrderId: str
|
|
42
|
+
key MaxResultsPerPage: int
|
|
43
|
+
key EasyShipShipmentStatuses: [str]
|
|
44
|
+
key NextToken: str
|
|
45
|
+
key AmazonOrderIds: [str]
|
|
46
|
+
key RestrictedResources: [str]
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
ApiResponse:
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
"""
|
|
53
|
+
normalize_csv_param(kwargs, "OrderStatuses")
|
|
54
|
+
normalize_csv_param(kwargs, "MarketplaceIds")
|
|
55
|
+
normalize_csv_param(kwargs, "FulfillmentChannels")
|
|
56
|
+
normalize_csv_param(kwargs, "PaymentMethods")
|
|
57
|
+
normalize_csv_param(kwargs, "AmazonOrderIds")
|
|
58
|
+
|
|
59
|
+
if "RestrictedResources" in kwargs:
|
|
60
|
+
return self._access_restricted(kwargs)
|
|
61
|
+
return self._request(kwargs.pop("path"), params={**kwargs})
|
|
62
|
+
|
|
63
|
+
@sp_endpoint("/orders/v0/orders/{}")
|
|
64
|
+
def get_order(self, order_id: str, **kwargs) -> ApiResponse:
|
|
65
|
+
"""
|
|
66
|
+
get_order(self, order_id: str, **kwargs) -> ApiResponse
|
|
67
|
+
Returns the order indicated by the specified order ID.
|
|
68
|
+
|
|
69
|
+
**Usage Plan:**
|
|
70
|
+
|
|
71
|
+
====================================== ==============
|
|
72
|
+
Rate (requests per second) Burst
|
|
73
|
+
====================================== ==============
|
|
74
|
+
1 1
|
|
75
|
+
====================================== ==============
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
79
|
+
|
|
80
|
+
Examples:
|
|
81
|
+
literal blocks::
|
|
82
|
+
|
|
83
|
+
Orders().get_order('TEST_CASE_200')
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
order_id: str
|
|
87
|
+
key RestrictedResources: [str]
|
|
88
|
+
**kwargs:
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
ApiResponse:
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
"""
|
|
95
|
+
if "RestrictedResources" in kwargs:
|
|
96
|
+
kwargs.update(
|
|
97
|
+
{"original_path": fill_query_params(kwargs.get("path"), order_id)}
|
|
98
|
+
)
|
|
99
|
+
return self._access_restricted(kwargs)
|
|
100
|
+
return self._request(
|
|
101
|
+
fill_query_params(kwargs.pop("path"), order_id),
|
|
102
|
+
params={**kwargs},
|
|
103
|
+
add_marketplace=False,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
@sp_endpoint("/orders/v0/orders/{}/orderItems")
|
|
107
|
+
def get_order_items(self, order_id: str, **kwargs) -> ApiResponse:
|
|
108
|
+
"""
|
|
109
|
+
get_order_items(self, order_id: str, **kwargs) -> ApiResponse
|
|
110
|
+
|
|
111
|
+
Returns detailed order item information for the order indicated by the specified order ID.
|
|
112
|
+
If NextToken is provided, it's used to retrieve the next page of order items.
|
|
113
|
+
|
|
114
|
+
Note: When an order is in the Pending state (the order has been placed but payment has not been authorized),
|
|
115
|
+
the getOrderItems operation does not return information about pricing, taxes, shipping charges, gift status or
|
|
116
|
+
promotions for the order items in the order.
|
|
117
|
+
After an order leaves the Pending state (this occurs when payment has been authorized) and enters the Unshipped,
|
|
118
|
+
Partially Shipped, or Shipped state, the getOrderItems operation returns information about pricing, taxes,
|
|
119
|
+
shipping charges, gift status and promotions for the order items in the order.
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
**Usage Plan:**
|
|
123
|
+
|
|
124
|
+
====================================== ==============
|
|
125
|
+
Rate (requests per second) Burst
|
|
126
|
+
====================================== ==============
|
|
127
|
+
1 1
|
|
128
|
+
====================================== ==============
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
133
|
+
|
|
134
|
+
Examples:
|
|
135
|
+
literal blocks::
|
|
136
|
+
|
|
137
|
+
Orders().get_order_items('TEST_CASE_200')
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
order_id: str
|
|
141
|
+
key RestrictedResources: [str]
|
|
142
|
+
**kwargs:
|
|
143
|
+
|
|
144
|
+
Returns:
|
|
145
|
+
ApiResponse:
|
|
146
|
+
|
|
147
|
+
"""
|
|
148
|
+
if "RestrictedResources" in kwargs:
|
|
149
|
+
kwargs.update(
|
|
150
|
+
{"original_path": fill_query_params(kwargs.get("path"), order_id)}
|
|
151
|
+
)
|
|
152
|
+
return self._access_restricted(kwargs)
|
|
153
|
+
return self._request(
|
|
154
|
+
fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
@sp_endpoint("/orders/v0/orders/{}/address")
|
|
158
|
+
def get_order_address(self, order_id, **kwargs) -> ApiResponse:
|
|
159
|
+
"""
|
|
160
|
+
get_order_address(self, order_id, **kwargs) -> ApiResponse
|
|
161
|
+
|
|
162
|
+
Returns the shipping address for the order indicated by the specified order ID.
|
|
163
|
+
|
|
164
|
+
:note: To get useful information from this method, you need to have access to PII.
|
|
165
|
+
|
|
166
|
+
**Usage Plan:**
|
|
167
|
+
|
|
168
|
+
====================================== ==============
|
|
169
|
+
Rate (requests per second) Burst
|
|
170
|
+
====================================== ==============
|
|
171
|
+
1 1
|
|
172
|
+
====================================== ==============
|
|
173
|
+
|
|
174
|
+
Examples:
|
|
175
|
+
Orders().get_order_address('TEST_CASE_200')
|
|
176
|
+
|
|
177
|
+
Args:
|
|
178
|
+
order_id: str
|
|
179
|
+
**kwargs:
|
|
180
|
+
|
|
181
|
+
Returns:
|
|
182
|
+
ApiResponse
|
|
183
|
+
"""
|
|
184
|
+
return self._request(
|
|
185
|
+
fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
@sp_endpoint("/orders/v0/orders/{}/buyerInfo")
|
|
189
|
+
def get_order_buyer_info(self, order_id: str, **kwargs) -> ApiResponse:
|
|
190
|
+
"""
|
|
191
|
+
get_order_buyer_info(self, order_id: str, **kwargs) -> ApiResponse
|
|
192
|
+
Returns buyer information for the order indicated by the specified order ID.
|
|
193
|
+
|
|
194
|
+
:note: To get useful information from this method, you need to have access to PII.
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
**Usage Plan:**
|
|
198
|
+
|
|
199
|
+
====================================== ==============
|
|
200
|
+
Rate (requests per second) Burst
|
|
201
|
+
====================================== ==============
|
|
202
|
+
1 1
|
|
203
|
+
====================================== ==============
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
207
|
+
|
|
208
|
+
Examples:
|
|
209
|
+
Orders().get_order_buyer_info('TEST_CASE_200')
|
|
210
|
+
|
|
211
|
+
Args:
|
|
212
|
+
order_id: str
|
|
213
|
+
**kwargs:
|
|
214
|
+
|
|
215
|
+
Returns:
|
|
216
|
+
GetOrderBuyerInfoResponse:
|
|
217
|
+
|
|
218
|
+
"""
|
|
219
|
+
return self._request(
|
|
220
|
+
fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
@sp_endpoint("/orders/v0/orders/{}/orderItems/buyerInfo")
|
|
224
|
+
def get_order_items_buyer_info(self, order_id: str, **kwargs) -> ApiResponse:
|
|
225
|
+
"""
|
|
226
|
+
get_order_items_buyer_info(self, order_id: str, **kwargs) -> ApiResponse
|
|
227
|
+
|
|
228
|
+
Returns buyer information in the order items of the order indicated by the specified order ID.
|
|
229
|
+
|
|
230
|
+
**Usage Plan:**
|
|
231
|
+
|
|
232
|
+
====================================== ==============
|
|
233
|
+
Rate (requests per second) Burst
|
|
234
|
+
====================================== ==============
|
|
235
|
+
1 1
|
|
236
|
+
====================================== ==============
|
|
237
|
+
|
|
238
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
239
|
+
|
|
240
|
+
Examples:
|
|
241
|
+
literal blocks::
|
|
242
|
+
|
|
243
|
+
Orders().get_order_items_buyer_info('TEST_CASE_200')
|
|
244
|
+
|
|
245
|
+
Args:
|
|
246
|
+
order_id: str
|
|
247
|
+
key NextToken: str | retrieve data by next token
|
|
248
|
+
|
|
249
|
+
Returns:
|
|
250
|
+
ApiResponse
|
|
251
|
+
"""
|
|
252
|
+
return self._request(
|
|
253
|
+
fill_query_params(kwargs.pop("path"), order_id), params=kwargs
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
@sp_endpoint("/orders/v0/orders/{}/shipment", method="POST")
|
|
257
|
+
def update_shipment_status(self, order_id: str, **kwargs) -> ApiResponse:
|
|
258
|
+
"""
|
|
259
|
+
update_shipment_status(self, order_id: str, **kwargs) -> ApiResponse
|
|
260
|
+
Update the shipment status.
|
|
261
|
+
**Usage Plan:**
|
|
262
|
+
====================================== ==============
|
|
263
|
+
Rate (requests per second) Burst
|
|
264
|
+
====================================== ==============
|
|
265
|
+
5 15
|
|
266
|
+
====================================== ==============
|
|
267
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
268
|
+
Examples:
|
|
269
|
+
literal blocks::
|
|
270
|
+
Orders().update_shipment_status(
|
|
271
|
+
order_id='123-1234567-1234567',
|
|
272
|
+
marketplaceId='ATVPDKIKX0DER',
|
|
273
|
+
shipmentStatus='ReadyForPickup'
|
|
274
|
+
)
|
|
275
|
+
Args:
|
|
276
|
+
order_id: str
|
|
277
|
+
Returns:
|
|
278
|
+
ApiResponse
|
|
279
|
+
"""
|
|
280
|
+
return self._request(
|
|
281
|
+
fill_query_params(kwargs.pop("path"), order_id),
|
|
282
|
+
res_no_data=True,
|
|
283
|
+
data=kwargs,
|
|
284
|
+
)
|
|
285
|
+
|
|
286
|
+
@sp_endpoint("/orders/v0/orders/{}/shipmentConfirmation", method="POST")
|
|
287
|
+
def confirm_shipment(self, order_id: str, **kwargs) -> ApiResponse:
|
|
288
|
+
"""
|
|
289
|
+
confirm_shipment(self, order_id: str, **kwargs) -> ApiResponse
|
|
290
|
+
Updates the shipment confirmation status for a specified order.
|
|
291
|
+
**Usage Plan:**
|
|
292
|
+
====================================== ==============
|
|
293
|
+
Rate (requests per second) Burst
|
|
294
|
+
====================================== ==============
|
|
295
|
+
2 10
|
|
296
|
+
====================================== ==============
|
|
297
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
298
|
+
Examples:
|
|
299
|
+
literal blocks::
|
|
300
|
+
Orders().confirm_shipment(
|
|
301
|
+
order_id='123-1234567-1234567',
|
|
302
|
+
marketplaceId='ATVPDKIKX0DER',
|
|
303
|
+
packageDetail={
|
|
304
|
+
'packageReferenceId': '0001',
|
|
305
|
+
'carrierCode': 'DHL',
|
|
306
|
+
"shippingMethod": 'Paket',
|
|
307
|
+
'trackingNumber': '1234567890',
|
|
308
|
+
'shipDate': '2023-03-19T12:00:00Z',
|
|
309
|
+
'orderItems': [
|
|
310
|
+
{
|
|
311
|
+
'orderItemId': '123456789',
|
|
312
|
+
'quantity': 1
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
'orderItemId': '2345678901',
|
|
316
|
+
'quantity': 2
|
|
317
|
+
},
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
)
|
|
321
|
+
Args:
|
|
322
|
+
order_id: str
|
|
323
|
+
Returns:
|
|
324
|
+
ApiResponse
|
|
325
|
+
"""
|
|
326
|
+
return self._request(
|
|
327
|
+
fill_query_params(kwargs.pop("path"), order_id),
|
|
328
|
+
add_marketplace=False,
|
|
329
|
+
res_no_data=True,
|
|
330
|
+
data=kwargs,
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
@sp_endpoint("/tokens/2021-03-01/restrictedDataToken", method="POST")
|
|
334
|
+
def _get_token(self, **kwargs):
|
|
335
|
+
data_elements = kwargs.pop("RestrictedResources")
|
|
336
|
+
|
|
337
|
+
restricted_resources = [
|
|
338
|
+
{
|
|
339
|
+
"method": "GET",
|
|
340
|
+
"path": kwargs.get("original_path"),
|
|
341
|
+
"dataElements": data_elements,
|
|
342
|
+
}
|
|
343
|
+
]
|
|
344
|
+
|
|
345
|
+
return self._request(
|
|
346
|
+
kwargs.pop("path"),
|
|
347
|
+
data={"restrictedResources": restricted_resources, **kwargs},
|
|
348
|
+
)
|
|
349
|
+
|
|
350
|
+
def _access_restricted(self, kwargs):
|
|
351
|
+
if "original_path" not in kwargs:
|
|
352
|
+
kwargs.update({"original_path": kwargs["path"]})
|
|
353
|
+
token = self._get_token(**kwargs).payload
|
|
354
|
+
self.restricted_data_token = token["restrictedDataToken"]
|
|
355
|
+
r = self._request(kwargs.pop("original_path"), params={**kwargs})
|
|
356
|
+
if not self.keep_restricted_data_token:
|
|
357
|
+
self.restricted_data_token = None
|
|
358
|
+
return r
|
|
359
|
+
|
sp_api/asyncio/api/__init__.py
CHANGED
|
@@ -2,6 +2,7 @@ from .finances.finances import Finances, FinancesVersion
|
|
|
2
2
|
from .notifications.notifications import Notifications
|
|
3
3
|
from .orders.orders import Orders, OrdersVersion
|
|
4
4
|
from .orders.orders_2026_01_01 import OrdersV20260101
|
|
5
|
+
from .orders.orders_v0 import OrdersV0
|
|
5
6
|
from .product_fees.product_fees import ProductFees
|
|
6
7
|
from .sellers.sellers import Sellers
|
|
7
8
|
from .reports.reports import Reports
|
|
@@ -106,6 +107,7 @@ __all__ = [
|
|
|
106
107
|
"Reports",
|
|
107
108
|
"Orders",
|
|
108
109
|
"OrdersVersion",
|
|
110
|
+
"OrdersV0",
|
|
109
111
|
"OrdersV20260101",
|
|
110
112
|
"Sellers",
|
|
111
113
|
"Notifications",
|