python-amazon-sp-api 2.0.7__py3-none-any.whl → 2.0.9__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-amazon-sp-api
3
- Version: 2.0.7
3
+ Version: 2.0.9
4
4
  Summary: Python wrapper for the Amazon Selling-Partner API
5
5
  Home-page: https://github.com/saleweaver/python-amazon-sp-api
6
6
  Author: Michael Primke
@@ -1,8 +1,8 @@
1
- python_amazon_sp_api-2.0.7.data/scripts/make_endpoint,sha256=QWcwG6z4RWFJlzj4-xyHJymjObyKtwkvWFRq8T18iG0,8568
2
- python_amazon_sp_api-2.0.7.dist-info/licenses/LICENSE,sha256=nbzomPIVo1PVl5bpGAntofsYAF7ZQ2UhzOtKgf7IiNw,1071
1
+ python_amazon_sp_api-2.0.9.data/scripts/make_endpoint,sha256=QWcwG6z4RWFJlzj4-xyHJymjObyKtwkvWFRq8T18iG0,8568
2
+ python_amazon_sp_api-2.0.9.dist-info/licenses/LICENSE,sha256=nbzomPIVo1PVl5bpGAntofsYAF7ZQ2UhzOtKgf7IiNw,1071
3
3
  sp_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- sp_api/__version__.py,sha256=Eqd_jrp6aA0AOwkbRY6r2MSGXmOOkqUkdUqKDmktZJM,22
5
- sp_api/api/__init__.py,sha256=QTDz2g_fryNGkGszhytqhI8K3x_ttP7fbXLJ5uRvmj0,4747
4
+ sp_api/__version__.py,sha256=YHfSoqxCUyNphrTJsW3Ed3e2IVM5_H1IYKii1J5IND4,22
5
+ sp_api/api/__init__.py,sha256=VFMbK4ipsL8w0Lv23BM_KsGtEnssBrxc6xXdutegVzw,4860
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,7 +50,8 @@ 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=TIbhUVnrm1CE7Wobgz3uKmHBpynVmSKzQREshT5fpiw,13227
53
+ sp_api/api/orders/orders.py,sha256=EAezN8gY6me-fzSwVnn0-vvs-pPD1hkn7RAU1JgrHu8,14562
54
+ sp_api/api/orders/orders_2026_01_01.py,sha256=bmFRS73z2PJaCSk9yvEPtGJA_8QQJu7BEvGP4c8ReLw,1912
54
55
  sp_api/api/product_fees/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
56
  sp_api/api/product_fees/product_fees.py,sha256=QwIVQKpXLXrc1Z2yQ2miSMizQsvprHVmxvG9vM_5niM,6913
56
57
  sp_api/api/product_type_definitions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -98,7 +99,7 @@ sp_api/api/vendor_shipments/vendor_shipments.py,sha256=EFzVetejcR3RLzH9iOMN_JFFX
98
99
  sp_api/api/vendor_transaction_status/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
99
100
  sp_api/api/vendor_transaction_status/vendor_transaction_status.py,sha256=hHDA4NSaLxuNUBWNpV5_MfPgRSEm3t0A7Yl9MY6pULc,1690
100
101
  sp_api/asyncio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
101
- sp_api/asyncio/api/__init__.py,sha256=QTDz2g_fryNGkGszhytqhI8K3x_ttP7fbXLJ5uRvmj0,4747
102
+ sp_api/asyncio/api/__init__.py,sha256=VFMbK4ipsL8w0Lv23BM_KsGtEnssBrxc6xXdutegVzw,4860
102
103
  sp_api/asyncio/api/amazon_warehousing_and_distribu/__init__.py,sha256=euZc6oTWMvMEOl-qcaVlS9QuQ5VC6FcUkF-tWYfbGAY,233
103
104
  sp_api/asyncio/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py,sha256=LDYSQNjGuWdTbfH-9ApC8QY2iRph_wv_Fc6Jv5L2m8k,5947
104
105
  sp_api/asyncio/api/aplus_content/__init__.py,sha256=JWgnKrh9Q6eUXogOMDl8ap5si-zjWoPzZGJ_TeJ5rSo,74
@@ -148,7 +149,8 @@ sp_api/asyncio/api/models/__init__.py,sha256=uHFaIn5OjyNVh8VXOqzqnC0ehTmd6fp_SRt
148
149
  sp_api/asyncio/api/notifications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
149
150
  sp_api/asyncio/api/notifications/notifications.py,sha256=xjg6nQ3Jgvk82TAovreQTneGocXKcY-Jk6flXrz0GhQ,11083
150
151
  sp_api/asyncio/api/orders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
151
- sp_api/asyncio/api/orders/orders.py,sha256=IKns8nkkaYYSekquS6F_JAcLEGboecSXRWUqb0YBp7w,13358
152
+ sp_api/asyncio/api/orders/orders.py,sha256=BpsWEabvgxeyye7b-jaTuSAL9_0WbBIsjSlmGEZxMI8,14733
153
+ sp_api/asyncio/api/orders/orders_2026_01_01.py,sha256=ZgIPCILgvvmNaXMhDW77grKD2C1f98p2rJhQi9mnfXg,1473
152
154
  sp_api/asyncio/api/overrides/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
153
155
  sp_api/asyncio/api/product_fees/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
154
156
  sp_api/asyncio/api/product_fees/product_fees.py,sha256=9GIQuoz37_QDmKnCe9wdjyqAhX5-z1n_AaTdvVyt_N8,6998
@@ -245,7 +247,7 @@ sp_api/util/product_fees.py,sha256=uvTct-armJYwkRsDn_2PBNOAD2H3_mfc8NqkFpjXzi4,1
245
247
  sp_api/util/products_definitions.py,sha256=TVO1L-vjyzSmL54Xfa0m3K6rVUFaTNsYBjeGnLpscDI,5061
246
248
  sp_api/util/report_document.py,sha256=_LxuIJDIb6DTvzobY4qdlQ78ibZi6rwQ1dDK3FMxegs,4682
247
249
  sp_api/util/retry.py,sha256=V8SeSeX3Brdou138hNA5HeQkKlHppZcqbZobIDjmBYw,2407
248
- python_amazon_sp_api-2.0.7.dist-info/METADATA,sha256=cCwizrFOz0V2JCtHcXXCc2bJW03Sw9sjwil4iu9SQUo,6968
249
- python_amazon_sp_api-2.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
250
- python_amazon_sp_api-2.0.7.dist-info/top_level.txt,sha256=mEzPMFyyy0LmJGY4KFXfh5usUka4eeouIr7-2IAzoE0,7
251
- python_amazon_sp_api-2.0.7.dist-info/RECORD,,
250
+ python_amazon_sp_api-2.0.9.dist-info/METADATA,sha256=rT0oMk5R-U6H3w4T6eqTE1l_JxPPRrqnAVyCO0ZrJ7U,6968
251
+ python_amazon_sp_api-2.0.9.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
252
+ python_amazon_sp_api-2.0.9.dist-info/top_level.txt,sha256=mEzPMFyyy0LmJGY4KFXfh5usUka4eeouIr7-2IAzoE0,7
253
+ python_amazon_sp_api-2.0.9.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
sp_api/__version__.py CHANGED
@@ -1 +1 @@
1
- __version__ = '2.0.7'
1
+ __version__ = '2.0.9'
sp_api/api/__init__.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from .finances.finances import Finances, FinancesVersion
2
2
  from .notifications.notifications import Notifications
3
- from .orders.orders import Orders
3
+ from .orders.orders import Orders, OrdersVersion
4
+ from .orders.orders_2026_01_01 import OrdersV20260101
4
5
  from .product_fees.product_fees import ProductFees
5
6
  from .sellers.sellers import Sellers
6
7
  from .reports.reports import Reports
@@ -104,6 +105,8 @@ __all__ = [
104
105
  "Products",
105
106
  "Reports",
106
107
  "Orders",
108
+ "OrdersVersion",
109
+ "OrdersV20260101",
107
110
  "Sellers",
108
111
  "Notifications",
109
112
  "ProductFees",
@@ -1,13 +1,61 @@
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
3
7
  from sp_api.util import normalize_csv_param
4
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"
16
+
5
17
 
6
18
  class Orders(Client):
7
- """
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
+
8
27
  :link: https://github.com/amzn/selling-partner-api-docs/tree/main/references/orders-api
9
28
  """
10
29
 
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
+
11
59
  @sp_endpoint("/orders/v0/orders")
12
60
  def get_orders(self, **kwargs) -> ApiResponse:
13
61
  """
@@ -360,3 +408,4 @@ class Orders(Client):
360
408
  if not self.keep_restricted_data_token:
361
409
  self.restricted_data_token = None
362
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
+ )
@@ -1,6 +1,7 @@
1
1
  from .finances.finances import Finances, FinancesVersion
2
2
  from .notifications.notifications import Notifications
3
- from .orders.orders import Orders
3
+ from .orders.orders import Orders, OrdersVersion
4
+ from .orders.orders_2026_01_01 import OrdersV20260101
4
5
  from .product_fees.product_fees import ProductFees
5
6
  from .sellers.sellers import Sellers
6
7
  from .reports.reports import Reports
@@ -104,6 +105,8 @@ __all__ = [
104
105
  "Products",
105
106
  "Reports",
106
107
  "Orders",
108
+ "OrdersVersion",
109
+ "OrdersV20260101",
107
110
  "Sellers",
108
111
  "Notifications",
109
112
  "ProductFees",
@@ -1,13 +1,62 @@
1
- from sp_api.base import sp_endpoint, fill_query_params, ApiResponse, deprecated
1
+ from __future__ import annotations
2
+
3
+ import enum
4
+ from typing import Any, Literal, overload
5
+
2
6
  from sp_api.asyncio.base import AsyncBaseClient
7
+ from sp_api.base import ApiResponse, deprecated, fill_query_params, sp_endpoint
3
8
  from sp_api.util import normalize_csv_param
4
9
 
10
+ from .orders_2026_01_01 import OrdersV20260101
11
+
12
+
13
+ class OrdersVersion(str, enum.Enum):
14
+ V0 = "v0" # legacy
15
+ V_2026_01_01 = "2026-01-01"
16
+ LATEST = "2026-01-01"
17
+
5
18
 
6
19
  class Orders(AsyncBaseClient):
7
- """
20
+ """Orders API client (async).
21
+
22
+ This class implements the legacy Orders API **v0**.
23
+
24
+ If you pass version "2026-01-01" (or :class:`OrdersVersion.V_2026_01_01`)
25
+ to the constructor, :meth:`__new__` returns an instance of
26
+ :class:`~sp_api.asyncio.api.orders.orders_2026_01_01.OrdersV20260101` instead.
27
+
8
28
  :link: https://github.com/amzn/selling-partner-api-docs/tree/main/references/orders-api
9
29
  """
10
30
 
31
+ @overload
32
+ def __new__(
33
+ cls,
34
+ *args: Any,
35
+ version: Literal[OrdersVersion.V_2026_01_01, "2026-01-01"],
36
+ **kwargs: Any,
37
+ ) -> OrdersV20260101: ...
38
+
39
+ @overload
40
+ def __new__(
41
+ cls,
42
+ *args: Any,
43
+ version: str | OrdersVersion | None = None,
44
+ **kwargs: Any,
45
+ ) -> "Orders": ...
46
+
47
+ def __new__(
48
+ cls,
49
+ *args: Any,
50
+ version: str | OrdersVersion | None = None,
51
+ **kwargs: Any,
52
+ ):
53
+ if cls is Orders:
54
+ v = version if version is not None else kwargs.get("version")
55
+ if v in (OrdersVersion.V_2026_01_01, OrdersVersion.LATEST, "2026-01-01"):
56
+ kwargs.pop("version", None)
57
+ return OrdersV20260101(*args, **kwargs)
58
+ return super().__new__(cls)
59
+
11
60
  @sp_endpoint("/orders/v0/orders")
12
61
  async def get_orders(self, **kwargs) -> ApiResponse:
13
62
  """
@@ -359,4 +408,5 @@ class Orders(AsyncBaseClient):
359
408
  r = await self._request(kwargs.pop("original_path"), params={**kwargs})
360
409
  if not self.keep_restricted_data_token:
361
410
  self.restricted_data_token = None
362
- return r
411
+ return r
412
+
@@ -0,0 +1,40 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
4
+
5
+ from sp_api.asyncio.base import AsyncBaseClient
6
+ from sp_api.base import ApiResponse, fill_query_params, sp_endpoint
7
+ from sp_api.util import normalize_csv_param
8
+
9
+
10
+ class OrdersV20260101(AsyncBaseClient):
11
+ """Orders API (version 2026-01-01) - async client.
12
+
13
+ This is a newer Orders API version that uses different endpoints/parameters
14
+ than the legacy v0 Orders API implemented by :class:`sp_api.asyncio.api.orders.orders.Orders`.
15
+
16
+ Model source:
17
+ https://github.com/amzn/selling-partner-api-models/blob/main/models/orders-api-model/orders_2026-01-01.json
18
+ """
19
+
20
+ @sp_endpoint("/orders/2026-01-01/orders")
21
+ async def search_orders(self, **kwargs: Any) -> ApiResponse:
22
+ """Search orders (async)."""
23
+
24
+ normalize_csv_param(kwargs, "fulfillmentStatuses")
25
+ normalize_csv_param(kwargs, "marketplaceIds")
26
+ normalize_csv_param(kwargs, "fulfilledBy")
27
+ normalize_csv_param(kwargs, "includedData")
28
+
29
+ return await self._request(kwargs.pop("path"), params={**kwargs})
30
+
31
+ @sp_endpoint("/orders/2026-01-01/orders/{}")
32
+ async def get_order(self, order_id: str, **kwargs: Any) -> ApiResponse:
33
+ """Get order by orderId (async)."""
34
+
35
+ normalize_csv_param(kwargs, "includedData")
36
+ return await self._request(
37
+ fill_query_params(kwargs.pop("path"), order_id),
38
+ params={**kwargs},
39
+ add_marketplace=False,
40
+ )