python-amazon-sp-api 1.7.5__py3-none-any.whl → 2.0.10__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.
Files changed (214) hide show
  1. {python_amazon_sp_api-1.7.5.data → python_amazon_sp_api-2.0.10.data}/scripts/make_endpoint +2 -2
  2. {python_amazon_sp_api-1.7.5.dist-info → python_amazon_sp_api-2.0.10.dist-info}/METADATA +58 -8
  3. python_amazon_sp_api-2.0.10.dist-info/RECORD +253 -0
  4. {python_amazon_sp_api-1.7.5.dist-info → python_amazon_sp_api-2.0.10.dist-info}/WHEEL +1 -1
  5. {python_amazon_sp_api-1.7.5.dist-info → python_amazon_sp_api-2.0.10.dist-info}/top_level.txt +0 -1
  6. sp_api/__version__.py +1 -1
  7. sp_api/api/__init__.py +48 -41
  8. sp_api/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +82 -76
  9. sp_api/api/aplus_content/aplus_content.py +76 -45
  10. sp_api/api/application_integrations/application_integrations.py +118 -0
  11. sp_api/api/application_management/application_management.py +6 -7
  12. sp_api/api/authorization/authorization.py +5 -5
  13. sp_api/api/catalog/catalog.py +9 -10
  14. sp_api/api/catalog_items/catalog_items.py +10 -13
  15. sp_api/api/customer_feedback/customer_feedback.py +110 -0
  16. sp_api/api/data_kiosk/data_kiosk.py +59 -39
  17. sp_api/api/easy_ship/easy_ship.py +190 -0
  18. sp_api/api/external_fulfillment/external_fulfillment.py +706 -0
  19. sp_api/api/fba_inbound_eligibility/fba_inbound_eligibility.py +23 -13
  20. sp_api/api/fba_small_and_light/fba_small_and_light.py +46 -20
  21. sp_api/api/feeds/feeds.py +60 -39
  22. sp_api/api/finances/finances.py +40 -9
  23. sp_api/api/fulfillment_inbound/fulfillment_inbound.py +844 -619
  24. sp_api/api/fulfillment_outbound/fulfillment_outbound.py +63 -57
  25. sp_api/api/inventories/inventories.py +13 -11
  26. sp_api/api/listings_items/listings_items.py +38 -25
  27. sp_api/api/listings_restrictions/listings_restrictions.py +6 -7
  28. sp_api/api/merchant_fulfillment/merchant_fulfillment.py +49 -36
  29. sp_api/api/messaging/messaging.py +129 -25
  30. sp_api/api/notifications/notifications.py +85 -45
  31. sp_api/api/orders/orders.py +123 -38
  32. sp_api/api/orders/orders_2026_01_01.py +54 -0
  33. sp_api/api/product_fees/product_fees.py +75 -67
  34. sp_api/api/product_type_definitions/product_type_definitions.py +9 -10
  35. sp_api/api/products/products.py +177 -53
  36. sp_api/api/products/products_definitions.py +11 -82
  37. sp_api/api/replenishment/replenishment.py +13 -11
  38. sp_api/api/reports/reports.py +113 -95
  39. sp_api/api/sales/sales.py +23 -13
  40. sp_api/api/sellers/sellers.py +3 -3
  41. sp_api/api/services/services.py +41 -30
  42. sp_api/api/shipping/shipping.py +39 -37
  43. sp_api/api/shipping/shippingV2.py +46 -30
  44. sp_api/api/solicitations/solicitations.py +20 -11
  45. sp_api/api/supply_sources/supply_sources.py +45 -37
  46. sp_api/api/tokens/tokens.py +4 -6
  47. sp_api/api/upload/upload.py +10 -8
  48. sp_api/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +10 -6
  49. sp_api/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +12 -14
  50. sp_api/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +4 -6
  51. sp_api/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +42 -37
  52. sp_api/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +8 -6
  53. sp_api/api/vendor_invoices/vendor_invoices.py +6 -4
  54. sp_api/api/vendor_orders/vendor_orders.py +16 -19
  55. sp_api/api/vendor_shipments/vendor_shipments.py +91 -262
  56. sp_api/api/vendor_transaction_status/vendor_transaction_status.py +6 -6
  57. sp_api/asyncio/api/__init__.py +167 -0
  58. sp_api/asyncio/api/amazon_warehousing_and_distribu/__init__.py +9 -0
  59. sp_api/asyncio/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +130 -0
  60. sp_api/asyncio/api/aplus_content/__init__.py +5 -0
  61. sp_api/asyncio/api/aplus_content/aplus_content.py +330 -0
  62. sp_api/asyncio/api/application_integrations/__init__.py +5 -0
  63. sp_api/asyncio/api/application_integrations/application_integrations.py +119 -0
  64. sp_api/asyncio/api/application_management/__init__.py +5 -0
  65. sp_api/asyncio/api/application_management/application_management.py +36 -0
  66. sp_api/asyncio/api/authorization/__init__.py +5 -0
  67. sp_api/asyncio/api/authorization/authorization.py +54 -0
  68. sp_api/asyncio/api/catalog/__init__.py +5 -0
  69. sp_api/asyncio/api/catalog/catalog.py +111 -0
  70. sp_api/asyncio/api/catalog_items/__init__.py +6 -0
  71. sp_api/asyncio/api/catalog_items/catalog_items.py +93 -0
  72. sp_api/asyncio/api/clients/__init__.py +1 -0
  73. sp_api/asyncio/api/customer_feedback/__init__.py +5 -0
  74. sp_api/asyncio/api/customer_feedback/customer_feedback.py +111 -0
  75. sp_api/asyncio/api/data_kiosk/__init__.py +5 -0
  76. sp_api/asyncio/api/data_kiosk/data_kiosk.py +236 -0
  77. sp_api/asyncio/api/easy_ship/__init__.py +5 -0
  78. sp_api/asyncio/api/easy_ship/easy_ship.py +191 -0
  79. sp_api/asyncio/api/external_fulfillment/__init__.py +5 -0
  80. sp_api/asyncio/api/external_fulfillment/external_fulfillment.py +706 -0
  81. sp_api/asyncio/api/fba_inbound_eligibility/__init__.py +5 -0
  82. sp_api/asyncio/api/fba_inbound_eligibility/fba_inbound_eligibility.py +96 -0
  83. sp_api/asyncio/api/fba_small_and_light/__init__.py +5 -0
  84. sp_api/asyncio/api/fba_small_and_light/fba_small_and_light.py +213 -0
  85. sp_api/asyncio/api/feeds/feeds.py +260 -0
  86. sp_api/asyncio/api/finances/finances.py +100 -0
  87. sp_api/asyncio/api/fulfillment_inbound/fulfillment_inbound.py +1798 -0
  88. sp_api/asyncio/api/fulfillment_outbound/fulfillment_outbound.py +736 -0
  89. sp_api/asyncio/api/inventories/inventories.py +74 -0
  90. sp_api/asyncio/api/listings_items/__init__.py +0 -0
  91. sp_api/asyncio/api/listings_items/listings_items.py +170 -0
  92. sp_api/asyncio/api/listings_restrictions/__init__.py +0 -0
  93. sp_api/asyncio/api/listings_restrictions/listings_restrictions.py +36 -0
  94. sp_api/asyncio/api/merchant_fulfillment/__init__.py +0 -0
  95. sp_api/asyncio/api/merchant_fulfillment/merchant_fulfillment.py +384 -0
  96. sp_api/asyncio/api/messaging/__init__.py +0 -0
  97. sp_api/asyncio/api/messaging/messaging.py +511 -0
  98. sp_api/asyncio/api/models/__init__.py +4 -0
  99. sp_api/asyncio/api/notifications/__init__.py +0 -0
  100. sp_api/asyncio/api/notifications/notifications.py +295 -0
  101. sp_api/asyncio/api/orders/__init__.py +0 -0
  102. sp_api/asyncio/api/orders/orders.py +412 -0
  103. sp_api/asyncio/api/orders/orders_2026_01_01.py +40 -0
  104. sp_api/asyncio/api/overrides/__init__.py +1 -0
  105. sp_api/asyncio/api/product_fees/__init__.py +0 -0
  106. sp_api/asyncio/api/product_fees/product_fees.py +194 -0
  107. sp_api/asyncio/api/product_type_definitions/__init__.py +0 -0
  108. sp_api/asyncio/api/product_type_definitions/product_type_definitions.py +75 -0
  109. sp_api/asyncio/api/products/__init__.py +0 -0
  110. sp_api/asyncio/api/products/products.py +405 -0
  111. sp_api/asyncio/api/products/products_definitions.py +11 -0
  112. sp_api/asyncio/api/replenishment/__init__.py +0 -0
  113. sp_api/asyncio/api/replenishment/replenishment.py +121 -0
  114. sp_api/asyncio/api/reports/__init__.py +0 -0
  115. sp_api/asyncio/api/reports/reports.py +439 -0
  116. sp_api/asyncio/api/sales/__init__.py +0 -0
  117. sp_api/asyncio/api/sales/sales.py +93 -0
  118. sp_api/asyncio/api/sellers/__init__.py +0 -0
  119. sp_api/asyncio/api/sellers/sellers.py +70 -0
  120. sp_api/asyncio/api/services/__init__.py +0 -0
  121. sp_api/asyncio/api/services/services.py +218 -0
  122. sp_api/asyncio/api/shipping/__init__.py +0 -0
  123. sp_api/asyncio/api/shipping/shipping.py +459 -0
  124. sp_api/asyncio/api/shipping/shippingV2.py +651 -0
  125. sp_api/asyncio/api/solicitations/__init__.py +0 -0
  126. sp_api/asyncio/api/solicitations/solicitations.py +78 -0
  127. sp_api/asyncio/api/supply_sources/__init__.py +0 -0
  128. sp_api/asyncio/api/supply_sources/supply_sources.py +138 -0
  129. sp_api/asyncio/api/tokens/__init__.py +0 -0
  130. sp_api/asyncio/api/tokens/tokens.py +65 -0
  131. sp_api/asyncio/api/upload/__init__.py +0 -0
  132. sp_api/asyncio/api/upload/upload.py +18 -0
  133. sp_api/asyncio/api/vendor_direct_fulfillment_inventory/__init__.py +0 -0
  134. sp_api/asyncio/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +64 -0
  135. sp_api/asyncio/api/vendor_direct_fulfillment_orders/__init__.py +0 -0
  136. sp_api/asyncio/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +196 -0
  137. sp_api/asyncio/api/vendor_direct_fulfillment_payments/__init__.py +0 -0
  138. sp_api/asyncio/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +254 -0
  139. sp_api/asyncio/api/vendor_direct_fulfillment_shipping/__init__.py +0 -0
  140. sp_api/asyncio/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +627 -0
  141. sp_api/asyncio/api/vendor_direct_fulfillment_transactions/__init__.py +0 -0
  142. sp_api/asyncio/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +43 -0
  143. sp_api/asyncio/api/vendor_invoices/__init__.py +0 -0
  144. sp_api/asyncio/api/vendor_invoices/vendor_invoices.py +295 -0
  145. sp_api/asyncio/api/vendor_orders/__init__.py +0 -0
  146. sp_api/asyncio/api/vendor_orders/vendor_orders.py +210 -0
  147. sp_api/asyncio/api/vendor_shipments/__init__.py +0 -0
  148. sp_api/asyncio/api/vendor_shipments/vendor_shipments.py +118 -0
  149. sp_api/asyncio/api/vendor_transaction_status/__init__.py +0 -0
  150. sp_api/asyncio/api/vendor_transaction_status/vendor_transaction_status.py +41 -0
  151. sp_api/asyncio/auth/__init__.py +12 -0
  152. sp_api/asyncio/auth/access_token_client.py +145 -0
  153. sp_api/asyncio/auth/exceptions.py +5 -0
  154. sp_api/asyncio/base/__init__.py +53 -0
  155. sp_api/asyncio/base/_transport_httpx.py +50 -0
  156. sp_api/asyncio/base/base_client.py +8 -0
  157. sp_api/asyncio/base/client.py +169 -0
  158. sp_api/asyncio/util/__init__.py +29 -0
  159. sp_api/asyncio/util/key_maker.py +5 -0
  160. sp_api/asyncio/util/load_all_pages.py +55 -0
  161. sp_api/asyncio/util/load_date_bound.py +53 -0
  162. sp_api/asyncio/util/retry.py +88 -0
  163. sp_api/auth/__init__.py +3 -3
  164. sp_api/auth/_core.py +39 -0
  165. sp_api/auth/access_token_client.py +20 -31
  166. sp_api/auth/access_token_response.py +4 -4
  167. sp_api/base/ApiResponse.py +5 -4
  168. sp_api/base/__init__.py +53 -42
  169. sp_api/base/_core.py +110 -0
  170. sp_api/base/_transport_httpx.py +39 -0
  171. sp_api/base/base_client.py +4 -4
  172. sp_api/base/client.py +131 -112
  173. sp_api/base/credential_provider.py +41 -34
  174. sp_api/base/exceptions.py +14 -3
  175. sp_api/base/feedTypes.py +44 -32
  176. sp_api/base/fulfillment_channel.py +2 -2
  177. sp_api/base/helpers.py +17 -16
  178. sp_api/base/identifiersType.py +8 -8
  179. sp_api/base/included_data.py +12 -12
  180. sp_api/base/marketplaces.py +5 -1
  181. sp_api/base/notifications.py +1 -1
  182. sp_api/base/processing_status.py +5 -5
  183. sp_api/base/reportTypes.py +198 -111
  184. sp_api/base/sales_enum.py +11 -13
  185. sp_api/util/__init__.py +42 -6
  186. sp_api/util/key_maker.py +4 -2
  187. sp_api/util/load_all_pages.py +16 -5
  188. sp_api/util/load_date_bound.py +28 -13
  189. sp_api/util/params.py +57 -0
  190. sp_api/util/product_fees.py +40 -0
  191. sp_api/util/products_definitions.py +169 -0
  192. sp_api/util/report_document.py +154 -0
  193. sp_api/util/retry.py +16 -15
  194. python_amazon_sp_api-1.7.5.dist-info/RECORD +0 -144
  195. tests/api/finances/test_finances.py +0 -19
  196. tests/api/notifications/test_notifications.py +0 -26
  197. tests/api/orders/test_orders.py +0 -122
  198. tests/api/product_fees/product_fees.py +0 -49
  199. tests/api/reports/test_reports.py +0 -127
  200. tests/client/test_auth.py +0 -59
  201. tests/client/test_base.py +0 -163
  202. tests/client/test_credential_provider.py +0 -45
  203. tests/client/test_helpers.py +0 -142
  204. {python_amazon_sp_api-1.7.5.dist-info → python_amazon_sp_api-2.0.10.dist-info/licenses}/LICENSE +0 -0
  205. {tests → sp_api/api/application_integrations}/__init__.py +0 -0
  206. {tests/api → sp_api/api/customer_feedback}/__init__.py +0 -0
  207. {tests/api/finances → sp_api/api/easy_ship}/__init__.py +0 -0
  208. {tests/api/notifications → sp_api/api/external_fulfillment}/__init__.py +0 -0
  209. {tests/api/orders → sp_api/asyncio}/__init__.py +0 -0
  210. {tests/api/product_fees → sp_api/asyncio/api/feeds}/__init__.py +0 -0
  211. {tests/api/reports → sp_api/asyncio/api/finances}/__init__.py +0 -0
  212. {tests/api/sellers → sp_api/asyncio/api/fulfillment_inbound}/__init__.py +0 -0
  213. {tests/client → sp_api/asyncio/api/fulfillment_outbound}/__init__.py +0 -0
  214. /tests/api/sellers/test_sellers.py → /sp_api/asyncio/api/inventories/__init__.py +0 -0
@@ -1,13 +1,62 @@
1
- from sp_api.base import sp_endpoint, fill_query_params, ApiResponse, deprecated
2
- from sp_api.base import Client, Marketplaces
1
+ from __future__ import annotations
2
+
3
+ import enum
4
+ from typing import Any, Literal, overload
5
+
6
+ from sp_api.base import ApiResponse, Client, Marketplaces, deprecated, fill_query_params, sp_endpoint
7
+ from sp_api.util import normalize_csv_param
8
+
9
+ from .orders_2026_01_01 import OrdersV20260101
10
+
11
+
12
+ class OrdersVersion(str, enum.Enum):
13
+ V0 = "v0" # legacy
14
+ V_2026_01_01 = "2026-01-01"
15
+ LATEST = "2026-01-01"
3
16
 
4
17
 
5
18
  class Orders(Client):
6
- """
19
+ """Orders API client.
20
+
21
+ This class implements the legacy Orders API **v0**.
22
+
23
+ If you pass version "2026-01-01" (or :class:`OrdersVersion.V_2026_01_01`)
24
+ to the constructor, :meth:`__new__` returns an instance of
25
+ :class:`~sp_api.api.orders.orders_2026_01_01.OrdersV20260101` instead.
26
+
7
27
  :link: https://github.com/amzn/selling-partner-api-docs/tree/main/references/orders-api
8
28
  """
9
29
 
10
- @sp_endpoint('/orders/v0/orders')
30
+ @overload
31
+ def __new__(
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")
11
60
  def get_orders(self, **kwargs) -> ApiResponse:
12
61
  """
13
62
  get_orders(self, **kwargs) -> ApiResponse
@@ -53,11 +102,17 @@ class Orders(Client):
53
102
 
54
103
 
55
104
  """
56
- if 'RestrictedResources' in kwargs:
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:
57
112
  return self._access_restricted(kwargs)
58
- return self._request(kwargs.pop('path'), params={**kwargs})
113
+ return self._request(kwargs.pop("path"), params={**kwargs})
59
114
 
60
- @sp_endpoint('/orders/v0/orders/{}')
115
+ @sp_endpoint("/orders/v0/orders/{}")
61
116
  def get_order(self, order_id: str, **kwargs) -> ApiResponse:
62
117
  """
63
118
  get_order(self, order_id: str, **kwargs) -> ApiResponse
@@ -89,12 +144,18 @@ class Orders(Client):
89
144
 
90
145
 
91
146
  """
92
- if 'RestrictedResources' in kwargs:
93
- kwargs.update({'original_path': fill_query_params(kwargs.get('path'), order_id)})
147
+ if "RestrictedResources" in kwargs:
148
+ kwargs.update(
149
+ {"original_path": fill_query_params(kwargs.get("path"), order_id)}
150
+ )
94
151
  return self._access_restricted(kwargs)
95
- return self._request(fill_query_params(kwargs.pop('path'), order_id), params={**kwargs}, add_marketplace=False)
152
+ return self._request(
153
+ fill_query_params(kwargs.pop("path"), order_id),
154
+ params={**kwargs},
155
+ add_marketplace=False,
156
+ )
96
157
 
97
- @sp_endpoint('/orders/v0/orders/{}/orderItems')
158
+ @sp_endpoint("/orders/v0/orders/{}/orderItems")
98
159
  def get_order_items(self, order_id: str, **kwargs) -> ApiResponse:
99
160
  """
100
161
  get_order_items(self, order_id: str, **kwargs) -> ApiResponse
@@ -136,12 +197,16 @@ class Orders(Client):
136
197
  ApiResponse:
137
198
 
138
199
  """
139
- if 'RestrictedResources' in kwargs:
140
- kwargs.update({'original_path': fill_query_params(kwargs.get('path'), order_id)})
200
+ if "RestrictedResources" in kwargs:
201
+ kwargs.update(
202
+ {"original_path": fill_query_params(kwargs.get("path"), order_id)}
203
+ )
141
204
  return self._access_restricted(kwargs)
142
- return self._request(fill_query_params(kwargs.pop('path'), order_id), params={**kwargs})
205
+ return self._request(
206
+ fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
207
+ )
143
208
 
144
- @sp_endpoint('/orders/v0/orders/{}/address')
209
+ @sp_endpoint("/orders/v0/orders/{}/address")
145
210
  def get_order_address(self, order_id, **kwargs) -> ApiResponse:
146
211
  """
147
212
  get_order_address(self, order_id, **kwargs) -> ApiResponse
@@ -168,9 +233,11 @@ class Orders(Client):
168
233
  Returns:
169
234
  ApiResponse
170
235
  """
171
- return self._request(fill_query_params(kwargs.pop('path'), order_id), params={**kwargs})
236
+ return self._request(
237
+ fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
238
+ )
172
239
 
173
- @sp_endpoint('/orders/v0/orders/{}/buyerInfo')
240
+ @sp_endpoint("/orders/v0/orders/{}/buyerInfo")
174
241
  def get_order_buyer_info(self, order_id: str, **kwargs) -> ApiResponse:
175
242
  """
176
243
  get_order_buyer_info(self, order_id: str, **kwargs) -> ApiResponse
@@ -201,9 +268,11 @@ class Orders(Client):
201
268
  GetOrderBuyerInfoResponse:
202
269
 
203
270
  """
204
- return self._request(fill_query_params(kwargs.pop('path'), order_id), params={**kwargs})
271
+ return self._request(
272
+ fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
273
+ )
205
274
 
206
- @sp_endpoint('/orders/v0/orders/{}/orderItems/buyerInfo')
275
+ @sp_endpoint("/orders/v0/orders/{}/orderItems/buyerInfo")
207
276
  def get_order_items_buyer_info(self, order_id: str, **kwargs) -> ApiResponse:
208
277
  """
209
278
  get_order_items_buyer_info(self, order_id: str, **kwargs) -> ApiResponse
@@ -232,9 +301,11 @@ class Orders(Client):
232
301
  Returns:
233
302
  ApiResponse
234
303
  """
235
- return self._request(fill_query_params(kwargs.pop('path'), order_id), params=kwargs)
304
+ return self._request(
305
+ fill_query_params(kwargs.pop("path"), order_id), params=kwargs
306
+ )
236
307
 
237
- @sp_endpoint('/orders/v0/orders/{}/shipment', method='POST')
308
+ @sp_endpoint("/orders/v0/orders/{}/shipment", method="POST")
238
309
  def update_shipment_status(self, order_id: str, **kwargs) -> ApiResponse:
239
310
  """
240
311
  update_shipment_status(self, order_id: str, **kwargs) -> ApiResponse
@@ -258,9 +329,13 @@ class Orders(Client):
258
329
  Returns:
259
330
  ApiResponse
260
331
  """
261
- return self._request(fill_query_params(kwargs.pop('path'), order_id), res_no_data=True, data=kwargs)
332
+ return self._request(
333
+ fill_query_params(kwargs.pop("path"), order_id),
334
+ res_no_data=True,
335
+ data=kwargs,
336
+ )
262
337
 
263
- @sp_endpoint('/orders/v0/orders/{}/shipmentConfirmation', method='POST')
338
+ @sp_endpoint("/orders/v0/orders/{}/shipmentConfirmation", method="POST")
264
339
  def confirm_shipment(self, order_id: str, **kwargs) -> ApiResponse:
265
340
  """
266
341
  confirm_shipment(self, order_id: str, **kwargs) -> ApiResponse
@@ -300,27 +375,37 @@ class Orders(Client):
300
375
  Returns:
301
376
  ApiResponse
302
377
  """
303
- return self._request(fill_query_params(kwargs.pop('path'), order_id), add_marketplace=False, res_no_data=True,
304
- data=kwargs)
305
-
306
- @sp_endpoint('/tokens/2021-03-01/restrictedDataToken', method='POST')
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")
307
386
  def _get_token(self, **kwargs):
308
- data_elements = kwargs.pop('RestrictedResources')
387
+ data_elements = kwargs.pop("RestrictedResources")
309
388
 
310
- restricted_resources = [{
311
- "method": "GET",
312
- "path": kwargs.get('original_path'),
313
- "dataElements": data_elements
314
- }]
389
+ restricted_resources = [
390
+ {
391
+ "method": "GET",
392
+ "path": kwargs.get("original_path"),
393
+ "dataElements": data_elements,
394
+ }
395
+ ]
315
396
 
316
- return self._request(kwargs.pop('path'), data={'restrictedResources': restricted_resources, **kwargs})
397
+ return self._request(
398
+ kwargs.pop("path"),
399
+ data={"restrictedResources": restricted_resources, **kwargs},
400
+ )
317
401
 
318
402
  def _access_restricted(self, kwargs):
319
- if 'original_path' not in kwargs:
320
- kwargs.update({'original_path': kwargs['path']})
403
+ if "original_path" not in kwargs:
404
+ kwargs.update({"original_path": kwargs["path"]})
321
405
  token = self._get_token(**kwargs).payload
322
- self.restricted_data_token = token['restrictedDataToken']
323
- r = self._request(kwargs.pop('original_path'), params={**kwargs})
406
+ self.restricted_data_token = token["restrictedDataToken"]
407
+ r = self._request(kwargs.pop("original_path"), params={**kwargs})
324
408
  if not self.keep_restricted_data_token:
325
409
  self.restricted_data_token = None
326
410
  return r
411
+
@@ -0,0 +1,54 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
4
+
5
+ from sp_api.base import ApiResponse, Client, fill_query_params, sp_endpoint
6
+ from sp_api.util import normalize_csv_param
7
+
8
+
9
+ class OrdersV20260101(Client):
10
+ """Orders API (version 2026-01-01).
11
+
12
+ This is a newer Orders API version that uses different endpoints/parameters
13
+ than the legacy v0 Orders API implemented by :class:`sp_api.api.orders.orders.Orders`.
14
+
15
+ Model source:
16
+ https://github.com/amzn/selling-partner-api-models/blob/main/models/orders-api-model/orders_2026-01-01.json
17
+ """
18
+
19
+ @sp_endpoint("/orders/2026-01-01/orders")
20
+ def search_orders(self, **kwargs: Any) -> ApiResponse:
21
+ """Search orders.
22
+
23
+ Corresponds to GET /orders/2026-01-01/orders (operationId: searchOrders).
24
+
25
+ Notes:
26
+ - Parameters are lowerCamelCase in this version (e.g. createdAfter).
27
+ - List parameters can be passed as Python lists; they will be normalized
28
+ into a comma-delimited string.
29
+ """
30
+
31
+ normalize_csv_param(kwargs, "fulfillmentStatuses")
32
+ normalize_csv_param(kwargs, "marketplaceIds")
33
+ normalize_csv_param(kwargs, "fulfilledBy")
34
+ normalize_csv_param(kwargs, "includedData")
35
+
36
+ return self._request(kwargs.pop("path"), params={**kwargs})
37
+
38
+ @sp_endpoint("/orders/2026-01-01/orders/{}")
39
+ def get_order(self, order_id: str, **kwargs: Any) -> ApiResponse:
40
+ """Get order by orderId.
41
+
42
+ Corresponds to GET /orders/2026-01-01/orders/{orderId} (operationId: getOrder).
43
+
44
+ Args:
45
+ order_id: The Amazon order identifier.
46
+ includedData: Optional list of datasets to include in the response.
47
+ """
48
+
49
+ normalize_csv_param(kwargs, "includedData")
50
+ return self._request(
51
+ fill_query_params(kwargs.pop("path"), order_id),
52
+ params={**kwargs},
53
+ add_marketplace=False,
54
+ )
@@ -3,6 +3,7 @@ from urllib.parse import quote_plus
3
3
 
4
4
  from sp_api.base.helpers import sp_endpoint, fill_query_params
5
5
  from sp_api.base import Client, ApiResponse
6
+ from sp_api.util.product_fees import create_fees_body
6
7
 
7
8
 
8
9
  class ProductFees(Client):
@@ -10,11 +11,20 @@ class ProductFees(Client):
10
11
  :link: https://github.com/amzn/selling-partner-api-docs/tree/main/references/product-fees-api
11
12
  """
12
13
 
13
- @sp_endpoint('/products/fees/v0/listings/{}/feesEstimate', method='POST')
14
- def get_product_fees_estimate_for_sku(self, seller_sku, price: float, shipping_price=None, currency='USD',
15
- is_fba=False, points: dict = None, marketplace_id: str = None,
16
- optional_fulfillment_program: str = None, force_safe_sku: bool = True,
17
- **kwargs) -> ApiResponse:
14
+ @sp_endpoint("/products/fees/v0/listings/{}/feesEstimate", method="POST")
15
+ def get_product_fees_estimate_for_sku(
16
+ self,
17
+ seller_sku,
18
+ price: float,
19
+ shipping_price=None,
20
+ currency="USD",
21
+ is_fba=False,
22
+ points: dict = None,
23
+ marketplace_id: str = None,
24
+ optional_fulfillment_program: str = None,
25
+ force_safe_sku: bool = True,
26
+ **kwargs
27
+ ) -> ApiResponse:
18
28
  """
19
29
  get_product_fees_estimate_for_sku(self, seller_sku, price: float, shipping_price=None, currency='USD', is_fba=False, points: dict = dict, **kwargs) -> ApiResponse
20
30
 
@@ -50,17 +60,38 @@ class ProductFees(Client):
50
60
  """
51
61
 
52
62
  if force_safe_sku:
53
- #handle `forward slash` issue in SKU
63
+ # handle `forward slash` issue in SKU
54
64
  seller_sku = quote_plus(seller_sku)
55
65
 
56
- kwargs.update(self._create_body(price, shipping_price, currency, is_fba, seller_sku, points, marketplace_id, optional_fulfillment_program))
57
- return self._request(fill_query_params(kwargs.pop('path'), seller_sku), data=kwargs)
58
-
59
- @sp_endpoint('/products/fees/v0/items/{}/feesEstimate', method='POST')
60
- def get_product_fees_estimate_for_asin(self, asin, price: float, currency='USD', shipping_price=None, is_fba=False,
61
- points: dict = None, marketplace_id: str = None,
62
- optional_fulfillment_program: str = None,
63
- **kwargs) -> ApiResponse:
66
+ kwargs.update(
67
+ create_fees_body(
68
+ price=price,
69
+ shipping_price=shipping_price,
70
+ currency=currency,
71
+ is_fba=is_fba,
72
+ identifier=seller_sku,
73
+ points=points,
74
+ marketplace_id=marketplace_id or self.marketplace_id,
75
+ optional_fulfillment_program=optional_fulfillment_program,
76
+ )
77
+ )
78
+ return self._request(
79
+ fill_query_params(kwargs.pop("path"), seller_sku), data=kwargs
80
+ )
81
+
82
+ @sp_endpoint("/products/fees/v0/items/{}/feesEstimate", method="POST")
83
+ def get_product_fees_estimate_for_asin(
84
+ self,
85
+ asin,
86
+ price: float,
87
+ currency="USD",
88
+ shipping_price=None,
89
+ is_fba=False,
90
+ points: dict = None,
91
+ marketplace_id: str = None,
92
+ optional_fulfillment_program: str = None,
93
+ **kwargs
94
+ ) -> ApiResponse:
64
95
  """
65
96
  get_product_fees_estimate_for_asin(self, asin, price: float, currency='USD', shipping_price=None, is_fba=False, points: dict = dict, **kwargs) -> ApiResponse
66
97
 
@@ -93,9 +124,19 @@ class ProductFees(Client):
93
124
  ApiResponse:
94
125
 
95
126
  """
96
- kwargs.update(self._create_body(price, shipping_price, currency, is_fba, asin, points, marketplace_id, optional_fulfillment_program))
97
- return self._request(fill_query_params(kwargs.pop('path'), asin), data=kwargs)
98
-
127
+ kwargs.update(
128
+ create_fees_body(
129
+ price=price,
130
+ shipping_price=shipping_price,
131
+ currency=currency,
132
+ is_fba=is_fba,
133
+ identifier=asin,
134
+ points=points,
135
+ marketplace_id=marketplace_id or self.marketplace_id,
136
+ optional_fulfillment_program=optional_fulfillment_program,
137
+ )
138
+ )
139
+ return self._request(fill_query_params(kwargs.pop("path"), asin), data=kwargs)
99
140
 
100
141
  def get_product_fees_estimate(self, estimate_requests: List[dict]) -> ApiResponse:
101
142
  """
@@ -126,57 +167,24 @@ class ProductFees(Client):
126
167
  marketplace_id: str | Defaults to self.marketplace_id
127
168
  optional_fulfillment_program:
128
169
  """
129
- data = [
130
- dict(
131
- **self._create_body(**er)
170
+ data = []
171
+ for estimate in estimate_requests:
172
+ estimate_payload = dict(estimate)
173
+ marketplace_id = estimate_payload.pop("marketplace_id", None)
174
+ data.append(
175
+ dict(
176
+ **create_fees_body(
177
+ marketplace_id=marketplace_id or self.marketplace_id,
178
+ **estimate_payload,
179
+ )
180
+ )
132
181
  )
133
- for er in estimate_requests
134
- ]
135
- return self._request('/products/fees/v0/feesEstimate', data=data, params=dict(method='POST'), wrap_list=True)
136
-
137
-
138
- def _create_body(self, price, shipping_price=None, currency='USD', is_fba=False, identifier=None, points: dict = None,
139
- marketplace_id: str = None, optional_fulfillment_program: str=None, id_type=None, id_value=None):
140
- """
141
- Create request body
142
-
143
- Args:
144
- price:
145
- shipping_price:
146
- currency:
147
- is_fba:
148
- identifier:
149
- points:
150
-
151
- Returns:
152
-
153
- """
154
- body = {
155
- 'FeesEstimateRequest': {
156
- 'Identifier': identifier or str(price),
157
- 'PriceToEstimateFees': {
158
- 'ListingPrice': {
159
- 'Amount': price,
160
- 'CurrencyCode': currency
161
- },
162
- 'Shipping': {
163
- 'Amount': shipping_price,
164
- 'CurrencyCode': currency
165
- } if shipping_price else None,
166
- 'Points': points or None
167
- },
168
- 'IsAmazonFulfilled': is_fba,
169
- 'OptionalFulfillmentProgram': optional_fulfillment_program if is_fba is True and optional_fulfillment_program else None,
170
- 'MarketplaceId': marketplace_id or self.marketplace_id
171
- }
172
- }
173
-
174
- if id_type and id_value:
175
- body["IdType"] = id_type
176
- body["IdValue"] = id_value
177
-
178
- return body
179
-
182
+ return self._request(
183
+ "/products/fees/v0/feesEstimate",
184
+ data=data,
185
+ params=dict(method="POST"),
186
+ wrap_list=True,
187
+ )
180
188
 
181
189
  def _add_marketplaces(self, data):
182
190
  # MarketplaceID is a property of the body's FeesEstimateRequest for this section, and does
@@ -6,13 +6,12 @@ from sp_api.base import Client, sp_endpoint, fill_query_params, ApiResponse
6
6
  class ProductTypeDefinitions(Client):
7
7
  """
8
8
  ProductTypeDefinitions SP-API Client
9
- :link:
9
+ :link:
10
10
 
11
11
  The Selling Partner API for Product Type Definitions provides programmatic access to attribute and data requirements for product types in the Amazon catalog. Use this API to return the JSON Schema for a product type that you can then use with other Selling Partner APIs, such as the Selling Partner API for Listings Items, the Selling Partner API for Catalog Items, and the Selling Partner API for Feeds (for JSON-based listing feeds).
12
12
  """
13
13
 
14
-
15
- @sp_endpoint('/definitions/2020-09-01/productTypes', method='GET')
14
+ @sp_endpoint("/definitions/2020-09-01/productTypes", method="GET")
16
15
  def search_definitions_product_types(self, **kwargs) -> ApiResponse:
17
16
  """
18
17
  search_definitions_product_types(self, **kwargs) -> ApiResponse
@@ -36,11 +35,10 @@ class ProductTypeDefinitions(Client):
36
35
  Returns:
37
36
  ApiResponse:
38
37
  """
39
-
40
- return self._request(kwargs.pop('path'), params=kwargs)
41
-
42
38
 
43
- @sp_endpoint('/definitions/2020-09-01/productTypes/{}', method='GET')
39
+ return self._request(kwargs.pop("path"), params=kwargs)
40
+
41
+ @sp_endpoint("/definitions/2020-09-01/productTypes/{}", method="GET")
44
42
  def get_definitions_product_type(self, productType, **kwargs) -> ApiResponse:
45
43
  """
46
44
  get_definitions_product_type(self, productType, **kwargs) -> ApiResponse
@@ -70,6 +68,7 @@ class ProductTypeDefinitions(Client):
70
68
  Returns:
71
69
  ApiResponse:
72
70
  """
73
-
74
- return self._request(fill_query_params(kwargs.pop('path'), productType), params=kwargs)
75
-
71
+
72
+ return self._request(
73
+ fill_query_params(kwargs.pop("path"), productType), params=kwargs
74
+ )