python-amazon-sp-api 2.0.9__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.9.dist-info → python_amazon_sp_api-2.0.11.dist-info}/METADATA +1 -1
- {python_amazon_sp_api-2.0.9.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.9.data → python_amazon_sp_api-2.0.11.data}/scripts/make_endpoint +0 -0
- {python_amazon_sp_api-2.0.9.dist-info → python_amazon_sp_api-2.0.11.dist-info}/WHEEL +0 -0
- {python_amazon_sp_api-2.0.9.dist-info → python_amazon_sp_api-2.0.11.dist-info}/licenses/LICENSE +0 -0
- {python_amazon_sp_api-2.0.9.dist-info → python_amazon_sp_api-2.0.11.dist-info}/top_level.txt +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
python_amazon_sp_api-2.0.
|
|
2
|
-
python_amazon_sp_api-2.0.
|
|
1
|
+
python_amazon_sp_api-2.0.11.data/scripts/make_endpoint,sha256=QWcwG6z4RWFJlzj4-xyHJymjObyKtwkvWFRq8T18iG0,8568
|
|
2
|
+
python_amazon_sp_api-2.0.11.dist-info/licenses/LICENSE,sha256=nbzomPIVo1PVl5bpGAntofsYAF7ZQ2UhzOtKgf7IiNw,1071
|
|
3
3
|
sp_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
sp_api/__version__.py,sha256=
|
|
5
|
-
sp_api/api/__init__.py,sha256=
|
|
4
|
+
sp_api/__version__.py,sha256=kYhLv18j-O34kNxw6Eplm19f_daEvrswrqeZfkVEPRQ,23
|
|
5
|
+
sp_api/api/__init__.py,sha256=cNQXUvw1dzI0GNP9rKo28LgCsqp6OQ5pswKa2Y4ZXTo,4915
|
|
6
6
|
sp_api/api/amazon_warehousing_and_distribu/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
sp_api/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py,sha256=bMBIxIj0eu6Gi6WY3XLdHHYDzNCwz0-9X59Jo9DoqfE,5863
|
|
8
8
|
sp_api/api/aplus_content/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -50,8 +50,9 @@ sp_api/api/messaging/messaging.py,sha256=pb_LWzBiE6RRVR6NTT6AW0uoBsiPMaoE7TJ-uge
|
|
|
50
50
|
sp_api/api/notifications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
51
51
|
sp_api/api/notifications/notifications.py,sha256=VbMQcRHlrLuZqx252kDR9n0zX2FVcEUOO0rW-1QJ3Oc,10937
|
|
52
52
|
sp_api/api/orders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
|
-
sp_api/api/orders/orders.py,sha256=
|
|
54
|
-
sp_api/api/orders/orders_2026_01_01.py,sha256=
|
|
53
|
+
sp_api/api/orders/orders.py,sha256=PzIQ8iYyvre0S-g1OR2SLSeKSGlR83MDbot5MsNpfYI,4275
|
|
54
|
+
sp_api/api/orders/orders_2026_01_01.py,sha256=ymPiKTcfdWKjzR9K2kubb14XK8kqG-i9uZxxqN5ZOfk,1933
|
|
55
|
+
sp_api/api/orders/orders_v0.py,sha256=0JSAVdEkkF7VqDO7NABHzEjeGG3E1j65J3KrPaBK5fY,13073
|
|
55
56
|
sp_api/api/product_fees/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
56
57
|
sp_api/api/product_fees/product_fees.py,sha256=QwIVQKpXLXrc1Z2yQ2miSMizQsvprHVmxvG9vM_5niM,6913
|
|
57
58
|
sp_api/api/product_type_definitions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -99,7 +100,7 @@ sp_api/api/vendor_shipments/vendor_shipments.py,sha256=EFzVetejcR3RLzH9iOMN_JFFX
|
|
|
99
100
|
sp_api/api/vendor_transaction_status/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
100
101
|
sp_api/api/vendor_transaction_status/vendor_transaction_status.py,sha256=hHDA4NSaLxuNUBWNpV5_MfPgRSEm3t0A7Yl9MY6pULc,1690
|
|
101
102
|
sp_api/asyncio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
102
|
-
sp_api/asyncio/api/__init__.py,sha256=
|
|
103
|
+
sp_api/asyncio/api/__init__.py,sha256=cNQXUvw1dzI0GNP9rKo28LgCsqp6OQ5pswKa2Y4ZXTo,4915
|
|
103
104
|
sp_api/asyncio/api/amazon_warehousing_and_distribu/__init__.py,sha256=euZc6oTWMvMEOl-qcaVlS9QuQ5VC6FcUkF-tWYfbGAY,233
|
|
104
105
|
sp_api/asyncio/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py,sha256=LDYSQNjGuWdTbfH-9ApC8QY2iRph_wv_Fc6Jv5L2m8k,5947
|
|
105
106
|
sp_api/asyncio/api/aplus_content/__init__.py,sha256=JWgnKrh9Q6eUXogOMDl8ap5si-zjWoPzZGJ_TeJ5rSo,74
|
|
@@ -149,8 +150,9 @@ sp_api/asyncio/api/models/__init__.py,sha256=uHFaIn5OjyNVh8VXOqzqnC0ehTmd6fp_SRt
|
|
|
149
150
|
sp_api/asyncio/api/notifications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
150
151
|
sp_api/asyncio/api/notifications/notifications.py,sha256=xjg6nQ3Jgvk82TAovreQTneGocXKcY-Jk6flXrz0GhQ,11083
|
|
151
152
|
sp_api/asyncio/api/orders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
152
|
-
sp_api/asyncio/api/orders/orders.py,sha256=
|
|
153
|
-
sp_api/asyncio/api/orders/orders_2026_01_01.py,sha256=
|
|
153
|
+
sp_api/asyncio/api/orders/orders.py,sha256=wGmMnA6lWNlV9YTL7OYxU8VnKA4KpOAF1fVnRIN4Vac,4343
|
|
154
|
+
sp_api/asyncio/api/orders/orders_2026_01_01.py,sha256=RtUtdc8t6eAeM0NHmDGqTX1VpH0j3i8bPq1jXGw8MAk,4137
|
|
155
|
+
sp_api/asyncio/api/orders/orders_v0.py,sha256=FLMg899q-ot8b6qwXz11vPj-oZBnWpQL0Pl-x3eeZGo,13243
|
|
154
156
|
sp_api/asyncio/api/overrides/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
155
157
|
sp_api/asyncio/api/product_fees/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
156
158
|
sp_api/asyncio/api/product_fees/product_fees.py,sha256=9GIQuoz37_QDmKnCe9wdjyqAhX5-z1n_AaTdvVyt_N8,6998
|
|
@@ -247,7 +249,7 @@ sp_api/util/product_fees.py,sha256=uvTct-armJYwkRsDn_2PBNOAD2H3_mfc8NqkFpjXzi4,1
|
|
|
247
249
|
sp_api/util/products_definitions.py,sha256=TVO1L-vjyzSmL54Xfa0m3K6rVUFaTNsYBjeGnLpscDI,5061
|
|
248
250
|
sp_api/util/report_document.py,sha256=_LxuIJDIb6DTvzobY4qdlQ78ibZi6rwQ1dDK3FMxegs,4682
|
|
249
251
|
sp_api/util/retry.py,sha256=V8SeSeX3Brdou138hNA5HeQkKlHppZcqbZobIDjmBYw,2407
|
|
250
|
-
python_amazon_sp_api-2.0.
|
|
251
|
-
python_amazon_sp_api-2.0.
|
|
252
|
-
python_amazon_sp_api-2.0.
|
|
253
|
-
python_amazon_sp_api-2.0.
|
|
252
|
+
python_amazon_sp_api-2.0.11.dist-info/METADATA,sha256=A38R7NpcfBA5I88ghl4ZxoluzEu1j7UFZhEye8RxL4I,6969
|
|
253
|
+
python_amazon_sp_api-2.0.11.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
254
|
+
python_amazon_sp_api-2.0.11.dist-info/top_level.txt,sha256=mEzPMFyyy0LmJGY4KFXfh5usUka4eeouIr7-2IAzoE0,7
|
|
255
|
+
python_amazon_sp_api-2.0.11.dist-info/RECORD,,
|
sp_api/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '2.0.
|
|
1
|
+
__version__ = '2.0.11'
|
sp_api/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",
|
sp_api/api/orders/orders.py
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import enum
|
|
4
|
-
from typing import Any, Literal, overload
|
|
4
|
+
from typing import Any, Literal, TYPE_CHECKING, overload
|
|
5
5
|
|
|
6
6
|
from sp_api.base import ApiResponse, Client, Marketplaces, deprecated, fill_query_params, sp_endpoint
|
|
7
7
|
from sp_api.util import normalize_csv_param
|
|
8
8
|
|
|
9
9
|
from .orders_2026_01_01 import OrdersV20260101
|
|
10
|
-
|
|
10
|
+
from .orders_v0 import OrdersV0
|
|
11
11
|
|
|
12
12
|
class OrdersVersion(str, enum.Enum):
|
|
13
13
|
V0 = "v0" # legacy
|
|
@@ -15,397 +15,136 @@ class OrdersVersion(str, enum.Enum):
|
|
|
15
15
|
LATEST = "2026-01-01"
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
class
|
|
19
|
-
"""
|
|
18
|
+
class _VersionedClientMeta(type):
|
|
19
|
+
"""Metaclass that dispatches construction to a version-specific implementation.
|
|
20
20
|
|
|
21
|
-
This
|
|
21
|
+
This keeps the call-site ergonomic (`Orders(version=...)`) while allowing a single
|
|
22
|
+
place to implement the dispatch logic.
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
Subclasses should define:
|
|
25
|
+
- `_VERSION_MAP`: mapping of normalized version strings to implementation classes
|
|
26
|
+
- `_VERSION_ALIASES` (optional): mapping of alias strings to normalized versions
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
If no version is provided, the default version is used.
|
|
28
29
|
"""
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
cls,
|
|
33
|
-
*args: Any,
|
|
34
|
-
version: Literal[OrdersVersion.V_2026_01_01, "2026-01-01"],
|
|
35
|
-
**kwargs: Any,
|
|
36
|
-
) -> OrdersV20260101: ...
|
|
37
|
-
|
|
38
|
-
@overload
|
|
39
|
-
def __new__(
|
|
40
|
-
cls,
|
|
41
|
-
*args: Any,
|
|
42
|
-
version: str | OrdersVersion | None = None,
|
|
43
|
-
**kwargs: Any,
|
|
44
|
-
) -> "Orders": ...
|
|
45
|
-
|
|
46
|
-
def __new__(
|
|
47
|
-
cls,
|
|
48
|
-
*args: Any,
|
|
49
|
-
version: str | OrdersVersion | None = None,
|
|
50
|
-
**kwargs: Any,
|
|
51
|
-
):
|
|
52
|
-
if cls is Orders:
|
|
53
|
-
v = version if version is not None else kwargs.get("version")
|
|
54
|
-
if v in (OrdersVersion.V_2026_01_01, OrdersVersion.LATEST, "2026-01-01"):
|
|
55
|
-
kwargs.pop("version", None)
|
|
56
|
-
return OrdersV20260101(*args, **kwargs)
|
|
57
|
-
return super().__new__(cls)
|
|
58
|
-
|
|
59
|
-
@sp_endpoint("/orders/v0/orders")
|
|
60
|
-
def get_orders(self, **kwargs) -> ApiResponse:
|
|
61
|
-
"""
|
|
62
|
-
get_orders(self, **kwargs) -> ApiResponse
|
|
63
|
-
Returns orders created or updated during the time frame indicated by the specified parameters.
|
|
64
|
-
You can also apply a range of filtering criteria to narrow the list of orders returned.
|
|
65
|
-
If NextToken is present, that will be used to retrieve the orders instead of other criteria.
|
|
66
|
-
|
|
67
|
-
**Usage Plan:**
|
|
68
|
-
|
|
69
|
-
====================================== ==============
|
|
70
|
-
Rate (requests per second) Burst
|
|
71
|
-
====================================== ==============
|
|
72
|
-
1 1
|
|
73
|
-
====================================== ==============
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
77
|
-
|
|
78
|
-
Examples:
|
|
79
|
-
literal blocks::
|
|
80
|
-
|
|
81
|
-
Orders().get_orders(CreatedAfter='TEST_CASE_200', MarketplaceIds=["ATVPDKIKX0DER"])
|
|
82
|
-
|
|
83
|
-
Args:
|
|
84
|
-
key CreatedAfter: date
|
|
85
|
-
key CreatedBefore: date
|
|
86
|
-
key LastUpdatedAfter: date
|
|
87
|
-
key LastUpdatedBefore: date
|
|
88
|
-
key OrderStatuses: [str]
|
|
89
|
-
key MarketplaceIds: [str]
|
|
90
|
-
key FulfillmentChannels: [str]
|
|
91
|
-
key PaymentMethods: [str]
|
|
92
|
-
key BuyerEmail: str
|
|
93
|
-
key SellerOrderId: str
|
|
94
|
-
key MaxResultsPerPage: int
|
|
95
|
-
key EasyShipShipmentStatuses: [str]
|
|
96
|
-
key NextToken: str
|
|
97
|
-
key AmazonOrderIds: [str]
|
|
98
|
-
key RestrictedResources: [str]
|
|
99
|
-
|
|
100
|
-
Returns:
|
|
101
|
-
ApiResponse:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
"""
|
|
105
|
-
normalize_csv_param(kwargs, "OrderStatuses")
|
|
106
|
-
normalize_csv_param(kwargs, "MarketplaceIds")
|
|
107
|
-
normalize_csv_param(kwargs, "FulfillmentChannels")
|
|
108
|
-
normalize_csv_param(kwargs, "PaymentMethods")
|
|
109
|
-
normalize_csv_param(kwargs, "AmazonOrderIds")
|
|
110
|
-
|
|
111
|
-
if "RestrictedResources" in kwargs:
|
|
112
|
-
return self._access_restricted(kwargs)
|
|
113
|
-
return self._request(kwargs.pop("path"), params={**kwargs})
|
|
114
|
-
|
|
115
|
-
@sp_endpoint("/orders/v0/orders/{}")
|
|
116
|
-
def get_order(self, order_id: str, **kwargs) -> ApiResponse:
|
|
117
|
-
"""
|
|
118
|
-
get_order(self, order_id: str, **kwargs) -> ApiResponse
|
|
119
|
-
Returns the order indicated by the specified order ID.
|
|
120
|
-
|
|
121
|
-
**Usage Plan:**
|
|
122
|
-
|
|
123
|
-
====================================== ==============
|
|
124
|
-
Rate (requests per second) Burst
|
|
125
|
-
====================================== ==============
|
|
126
|
-
1 1
|
|
127
|
-
====================================== ==============
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
131
|
-
|
|
132
|
-
Examples:
|
|
133
|
-
literal blocks::
|
|
134
|
-
|
|
135
|
-
Orders().get_order('TEST_CASE_200')
|
|
136
|
-
|
|
137
|
-
Args:
|
|
138
|
-
order_id: str
|
|
139
|
-
key RestrictedResources: [str]
|
|
140
|
-
**kwargs:
|
|
141
|
-
|
|
142
|
-
Returns:
|
|
143
|
-
ApiResponse:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
"""
|
|
147
|
-
if "RestrictedResources" in kwargs:
|
|
148
|
-
kwargs.update(
|
|
149
|
-
{"original_path": fill_query_params(kwargs.get("path"), order_id)}
|
|
150
|
-
)
|
|
151
|
-
return self._access_restricted(kwargs)
|
|
152
|
-
return self._request(
|
|
153
|
-
fill_query_params(kwargs.pop("path"), order_id),
|
|
154
|
-
params={**kwargs},
|
|
155
|
-
add_marketplace=False,
|
|
156
|
-
)
|
|
157
|
-
|
|
158
|
-
@sp_endpoint("/orders/v0/orders/{}/orderItems")
|
|
159
|
-
def get_order_items(self, order_id: str, **kwargs) -> ApiResponse:
|
|
160
|
-
"""
|
|
161
|
-
get_order_items(self, order_id: str, **kwargs) -> ApiResponse
|
|
162
|
-
|
|
163
|
-
Returns detailed order item information for the order indicated by the specified order ID.
|
|
164
|
-
If NextToken is provided, it's used to retrieve the next page of order items.
|
|
165
|
-
|
|
166
|
-
Note: When an order is in the Pending state (the order has been placed but payment has not been authorized),
|
|
167
|
-
the getOrderItems operation does not return information about pricing, taxes, shipping charges, gift status or
|
|
168
|
-
promotions for the order items in the order.
|
|
169
|
-
After an order leaves the Pending state (this occurs when payment has been authorized) and enters the Unshipped,
|
|
170
|
-
Partially Shipped, or Shipped state, the getOrderItems operation returns information about pricing, taxes,
|
|
171
|
-
shipping charges, gift status and promotions for the order items in the order.
|
|
172
|
-
|
|
31
|
+
def __call__(cls, *args: Any, **kwargs: Any):
|
|
32
|
+
version = kwargs.pop("version", None)
|
|
173
33
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
)
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
34
|
+
# Only dispatch for the public front class itself.
|
|
35
|
+
if cls is Orders:
|
|
36
|
+
# Backwards-compatible default: if no version is provided, return the
|
|
37
|
+
# oldest supported implementation.
|
|
38
|
+
v_raw = version if version is not None else getattr(cls, "_DEFAULT_VERSION", None)
|
|
39
|
+
if v_raw is None:
|
|
40
|
+
return super().__call__(*args, **kwargs)
|
|
41
|
+
|
|
42
|
+
v_raw = getattr(v_raw, "value", v_raw)
|
|
43
|
+
v = str(v_raw)
|
|
44
|
+
aliases: dict[str, str] = getattr(cls, "_VERSION_ALIASES", {})
|
|
45
|
+
v_norm = aliases.get(v, v)
|
|
46
|
+
|
|
47
|
+
impl_map: dict[str, type] = getattr(cls, "_VERSION_MAP", {})
|
|
48
|
+
impl = impl_map.get(v_norm)
|
|
49
|
+
if impl is not None:
|
|
50
|
+
return impl(*args, **kwargs)
|
|
51
|
+
|
|
52
|
+
supported = ", ".join(sorted(impl_map.keys()))
|
|
53
|
+
raise ValueError(f"Unsupported version {v!r}. Supported: {supported}")
|
|
54
|
+
|
|
55
|
+
return super().__call__(*args, **kwargs)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
if TYPE_CHECKING:
|
|
59
|
+
|
|
60
|
+
class _OrdersMeta(_VersionedClientMeta):
|
|
61
|
+
@overload
|
|
62
|
+
def __call__(
|
|
63
|
+
self,
|
|
64
|
+
*args: Any,
|
|
65
|
+
version: Literal[OrdersVersion.V_2026_01_01, OrdersVersion.LATEST, "2026-01-01"],
|
|
66
|
+
**kwargs: Any,
|
|
67
|
+
) -> OrdersV20260101: ...
|
|
68
|
+
|
|
69
|
+
@overload
|
|
70
|
+
def __call__(
|
|
71
|
+
self,
|
|
72
|
+
*args: Any,
|
|
73
|
+
version: Literal[OrdersVersion.V0, "v0"],
|
|
74
|
+
**kwargs: Any,
|
|
75
|
+
) -> OrdersV0: ...
|
|
76
|
+
|
|
77
|
+
@overload
|
|
78
|
+
def __call__(
|
|
79
|
+
self,
|
|
80
|
+
*args: Any,
|
|
81
|
+
version: None = None,
|
|
82
|
+
**kwargs: Any,
|
|
83
|
+
) -> OrdersV0: ...
|
|
84
|
+
|
|
85
|
+
@overload
|
|
86
|
+
def __call__(
|
|
87
|
+
self,
|
|
88
|
+
*args: Any,
|
|
89
|
+
version: str | OrdersVersion,
|
|
90
|
+
**kwargs: Any,
|
|
91
|
+
) -> Client: ...
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
else:
|
|
95
|
+
_OrdersMeta = _VersionedClientMeta
|
|
96
|
+
|
|
97
|
+
class Orders(Client, metaclass=_OrdersMeta):
|
|
98
|
+
"""Orders API client.
|
|
219
99
|
|
|
220
|
-
|
|
221
|
-
Rate (requests per second) Burst
|
|
222
|
-
====================================== ==============
|
|
223
|
-
1 1
|
|
224
|
-
====================================== ==============
|
|
100
|
+
This class dispatches to a versioned Orders API client.
|
|
225
101
|
|
|
226
|
-
|
|
227
|
-
Orders().get_order_address('TEST_CASE_200')
|
|
102
|
+
If you do not pass a version, the constructor returns the oldest supported implementation ("v0").
|
|
228
103
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
**kwargs:
|
|
232
|
-
|
|
233
|
-
Returns:
|
|
234
|
-
ApiResponse
|
|
235
|
-
"""
|
|
236
|
-
return self._request(
|
|
237
|
-
fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
|
|
238
|
-
)
|
|
239
|
-
|
|
240
|
-
@sp_endpoint("/orders/v0/orders/{}/buyerInfo")
|
|
241
|
-
def get_order_buyer_info(self, order_id: str, **kwargs) -> ApiResponse:
|
|
242
|
-
"""
|
|
243
|
-
get_order_buyer_info(self, order_id: str, **kwargs) -> ApiResponse
|
|
244
|
-
Returns buyer information for the order indicated by the specified order ID.
|
|
245
|
-
|
|
246
|
-
:note: To get useful information from this method, you need to have access to PII.
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
**Usage Plan:**
|
|
250
|
-
|
|
251
|
-
====================================== ==============
|
|
252
|
-
Rate (requests per second) Burst
|
|
253
|
-
====================================== ==============
|
|
254
|
-
1 1
|
|
255
|
-
====================================== ==============
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
259
|
-
|
|
260
|
-
Examples:
|
|
261
|
-
Orders().get_order_buyer_info('TEST_CASE_200')
|
|
262
|
-
|
|
263
|
-
Args:
|
|
264
|
-
order_id: str
|
|
265
|
-
**kwargs:
|
|
266
|
-
|
|
267
|
-
Returns:
|
|
268
|
-
GetOrderBuyerInfoResponse:
|
|
269
|
-
|
|
270
|
-
"""
|
|
271
|
-
return self._request(
|
|
272
|
-
fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
|
|
273
|
-
)
|
|
274
|
-
|
|
275
|
-
@sp_endpoint("/orders/v0/orders/{}/orderItems/buyerInfo")
|
|
276
|
-
def get_order_items_buyer_info(self, order_id: str, **kwargs) -> ApiResponse:
|
|
277
|
-
"""
|
|
278
|
-
get_order_items_buyer_info(self, order_id: str, **kwargs) -> ApiResponse
|
|
279
|
-
|
|
280
|
-
Returns buyer information in the order items of the order indicated by the specified order ID.
|
|
281
|
-
|
|
282
|
-
**Usage Plan:**
|
|
283
|
-
|
|
284
|
-
====================================== ==============
|
|
285
|
-
Rate (requests per second) Burst
|
|
286
|
-
====================================== ==============
|
|
287
|
-
1 1
|
|
288
|
-
====================================== ==============
|
|
289
|
-
|
|
290
|
-
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
291
|
-
|
|
292
|
-
Examples:
|
|
293
|
-
literal blocks::
|
|
294
|
-
|
|
295
|
-
Orders().get_order_items_buyer_info('TEST_CASE_200')
|
|
296
|
-
|
|
297
|
-
Args:
|
|
298
|
-
order_id: str
|
|
299
|
-
key NextToken: str | retrieve data by next token
|
|
300
|
-
|
|
301
|
-
Returns:
|
|
302
|
-
ApiResponse
|
|
303
|
-
"""
|
|
304
|
-
return self._request(
|
|
305
|
-
fill_query_params(kwargs.pop("path"), order_id), params=kwargs
|
|
306
|
-
)
|
|
307
|
-
|
|
308
|
-
@sp_endpoint("/orders/v0/orders/{}/shipment", method="POST")
|
|
309
|
-
def update_shipment_status(self, order_id: str, **kwargs) -> ApiResponse:
|
|
310
|
-
"""
|
|
311
|
-
update_shipment_status(self, order_id: str, **kwargs) -> ApiResponse
|
|
312
|
-
Update the shipment status.
|
|
313
|
-
**Usage Plan:**
|
|
314
|
-
====================================== ==============
|
|
315
|
-
Rate (requests per second) Burst
|
|
316
|
-
====================================== ==============
|
|
317
|
-
5 15
|
|
318
|
-
====================================== ==============
|
|
319
|
-
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
320
|
-
Examples:
|
|
321
|
-
literal blocks::
|
|
322
|
-
Orders().update_shipment_status(
|
|
323
|
-
order_id='123-1234567-1234567',
|
|
324
|
-
marketplaceId='ATVPDKIKX0DER',
|
|
325
|
-
shipmentStatus='ReadyForPickup'
|
|
326
|
-
)
|
|
327
|
-
Args:
|
|
328
|
-
order_id: str
|
|
329
|
-
Returns:
|
|
330
|
-
ApiResponse
|
|
331
|
-
"""
|
|
332
|
-
return self._request(
|
|
333
|
-
fill_query_params(kwargs.pop("path"), order_id),
|
|
334
|
-
res_no_data=True,
|
|
335
|
-
data=kwargs,
|
|
336
|
-
)
|
|
337
|
-
|
|
338
|
-
@sp_endpoint("/orders/v0/orders/{}/shipmentConfirmation", method="POST")
|
|
339
|
-
def confirm_shipment(self, order_id: str, **kwargs) -> ApiResponse:
|
|
340
|
-
"""
|
|
341
|
-
confirm_shipment(self, order_id: str, **kwargs) -> ApiResponse
|
|
342
|
-
Updates the shipment confirmation status for a specified order.
|
|
343
|
-
**Usage Plan:**
|
|
344
|
-
====================================== ==============
|
|
345
|
-
Rate (requests per second) Burst
|
|
346
|
-
====================================== ==============
|
|
347
|
-
2 10
|
|
348
|
-
====================================== ==============
|
|
349
|
-
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
350
|
-
Examples:
|
|
351
|
-
literal blocks::
|
|
352
|
-
Orders().confirm_shipment(
|
|
353
|
-
order_id='123-1234567-1234567',
|
|
354
|
-
marketplaceId='ATVPDKIKX0DER',
|
|
355
|
-
packageDetail={
|
|
356
|
-
'packageReferenceId': '0001',
|
|
357
|
-
'carrierCode': 'DHL',
|
|
358
|
-
"shippingMethod": 'Paket',
|
|
359
|
-
'trackingNumber': '1234567890',
|
|
360
|
-
'shipDate': '2023-03-19T12:00:00Z',
|
|
361
|
-
'orderItems': [
|
|
362
|
-
{
|
|
363
|
-
'orderItemId': '123456789',
|
|
364
|
-
'quantity': 1
|
|
365
|
-
},
|
|
366
|
-
{
|
|
367
|
-
'orderItemId': '2345678901',
|
|
368
|
-
'quantity': 2
|
|
369
|
-
},
|
|
370
|
-
]
|
|
371
|
-
}
|
|
372
|
-
)
|
|
373
|
-
Args:
|
|
374
|
-
order_id: str
|
|
375
|
-
Returns:
|
|
376
|
-
ApiResponse
|
|
377
|
-
"""
|
|
378
|
-
return self._request(
|
|
379
|
-
fill_query_params(kwargs.pop("path"), order_id),
|
|
380
|
-
add_marketplace=False,
|
|
381
|
-
res_no_data=True,
|
|
382
|
-
data=kwargs,
|
|
383
|
-
)
|
|
384
|
-
|
|
385
|
-
@sp_endpoint("/tokens/2021-03-01/restrictedDataToken", method="POST")
|
|
386
|
-
def _get_token(self, **kwargs):
|
|
387
|
-
data_elements = kwargs.pop("RestrictedResources")
|
|
388
|
-
|
|
389
|
-
restricted_resources = [
|
|
390
|
-
{
|
|
391
|
-
"method": "GET",
|
|
392
|
-
"path": kwargs.get("original_path"),
|
|
393
|
-
"dataElements": data_elements,
|
|
394
|
-
}
|
|
395
|
-
]
|
|
396
|
-
|
|
397
|
-
return self._request(
|
|
398
|
-
kwargs.pop("path"),
|
|
399
|
-
data={"restrictedResources": restricted_resources, **kwargs},
|
|
400
|
-
)
|
|
401
|
-
|
|
402
|
-
def _access_restricted(self, kwargs):
|
|
403
|
-
if "original_path" not in kwargs:
|
|
404
|
-
kwargs.update({"original_path": kwargs["path"]})
|
|
405
|
-
token = self._get_token(**kwargs).payload
|
|
406
|
-
self.restricted_data_token = token["restrictedDataToken"]
|
|
407
|
-
r = self._request(kwargs.pop("original_path"), params={**kwargs})
|
|
408
|
-
if not self.keep_restricted_data_token:
|
|
409
|
-
self.restricted_data_token = None
|
|
410
|
-
return r
|
|
104
|
+
:link: https://github.com/amzn/selling-partner-api-docs/tree/main/references/orders-api
|
|
105
|
+
"""
|
|
411
106
|
|
|
107
|
+
if TYPE_CHECKING:
|
|
108
|
+
@overload
|
|
109
|
+
def __new__(
|
|
110
|
+
cls,
|
|
111
|
+
*args: Any,
|
|
112
|
+
version: Literal[OrdersVersion.V_2026_01_01, OrdersVersion.LATEST, "2026-01-01"],
|
|
113
|
+
**kwargs: Any,
|
|
114
|
+
) -> OrdersV20260101: ...
|
|
115
|
+
|
|
116
|
+
@overload
|
|
117
|
+
def __new__(
|
|
118
|
+
cls,
|
|
119
|
+
*args: Any,
|
|
120
|
+
version: Literal[OrdersVersion.V0, "v0"],
|
|
121
|
+
**kwargs: Any,
|
|
122
|
+
) -> OrdersV0: ...
|
|
123
|
+
|
|
124
|
+
@overload
|
|
125
|
+
def __new__(
|
|
126
|
+
cls,
|
|
127
|
+
*args: Any,
|
|
128
|
+
version: None = None,
|
|
129
|
+
**kwargs: Any,
|
|
130
|
+
) -> OrdersV0: ...
|
|
131
|
+
|
|
132
|
+
@overload
|
|
133
|
+
def __new__(
|
|
134
|
+
cls,
|
|
135
|
+
*args: Any,
|
|
136
|
+
version: str | OrdersVersion,
|
|
137
|
+
**kwargs: Any,
|
|
138
|
+
) -> Client: ...
|
|
139
|
+
|
|
140
|
+
_DEFAULT_VERSION = "v0"
|
|
141
|
+
|
|
142
|
+
_VERSION_MAP = {
|
|
143
|
+
"v0": OrdersV0,
|
|
144
|
+
"2026-01-01": OrdersV20260101,
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
_VERSION_ALIASES = {
|
|
148
|
+
"v0": "v0",
|
|
149
|
+
"2026-01-01": "2026-01-01",
|
|
150
|
+
}
|
|
@@ -32,7 +32,7 @@ class OrdersV20260101(Client):
|
|
|
32
32
|
normalize_csv_param(kwargs, "marketplaceIds")
|
|
33
33
|
normalize_csv_param(kwargs, "fulfilledBy")
|
|
34
34
|
normalize_csv_param(kwargs, "includedData")
|
|
35
|
-
|
|
35
|
+
print(kwargs)
|
|
36
36
|
return self._request(kwargs.pop("path"), params={**kwargs})
|
|
37
37
|
|
|
38
38
|
@sp_endpoint("/orders/2026-01-01/orders/{}")
|