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.
- {python_amazon_sp_api-1.7.5.data → python_amazon_sp_api-2.0.10.data}/scripts/make_endpoint +2 -2
- {python_amazon_sp_api-1.7.5.dist-info → python_amazon_sp_api-2.0.10.dist-info}/METADATA +58 -8
- python_amazon_sp_api-2.0.10.dist-info/RECORD +253 -0
- {python_amazon_sp_api-1.7.5.dist-info → python_amazon_sp_api-2.0.10.dist-info}/WHEEL +1 -1
- {python_amazon_sp_api-1.7.5.dist-info → python_amazon_sp_api-2.0.10.dist-info}/top_level.txt +0 -1
- sp_api/__version__.py +1 -1
- sp_api/api/__init__.py +48 -41
- sp_api/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +82 -76
- sp_api/api/aplus_content/aplus_content.py +76 -45
- sp_api/api/application_integrations/application_integrations.py +118 -0
- sp_api/api/application_management/application_management.py +6 -7
- sp_api/api/authorization/authorization.py +5 -5
- sp_api/api/catalog/catalog.py +9 -10
- sp_api/api/catalog_items/catalog_items.py +10 -13
- sp_api/api/customer_feedback/customer_feedback.py +110 -0
- sp_api/api/data_kiosk/data_kiosk.py +59 -39
- sp_api/api/easy_ship/easy_ship.py +190 -0
- sp_api/api/external_fulfillment/external_fulfillment.py +706 -0
- sp_api/api/fba_inbound_eligibility/fba_inbound_eligibility.py +23 -13
- sp_api/api/fba_small_and_light/fba_small_and_light.py +46 -20
- sp_api/api/feeds/feeds.py +60 -39
- sp_api/api/finances/finances.py +40 -9
- sp_api/api/fulfillment_inbound/fulfillment_inbound.py +844 -619
- sp_api/api/fulfillment_outbound/fulfillment_outbound.py +63 -57
- sp_api/api/inventories/inventories.py +13 -11
- sp_api/api/listings_items/listings_items.py +38 -25
- sp_api/api/listings_restrictions/listings_restrictions.py +6 -7
- sp_api/api/merchant_fulfillment/merchant_fulfillment.py +49 -36
- sp_api/api/messaging/messaging.py +129 -25
- sp_api/api/notifications/notifications.py +85 -45
- sp_api/api/orders/orders.py +123 -38
- sp_api/api/orders/orders_2026_01_01.py +54 -0
- sp_api/api/product_fees/product_fees.py +75 -67
- sp_api/api/product_type_definitions/product_type_definitions.py +9 -10
- sp_api/api/products/products.py +177 -53
- sp_api/api/products/products_definitions.py +11 -82
- sp_api/api/replenishment/replenishment.py +13 -11
- sp_api/api/reports/reports.py +113 -95
- sp_api/api/sales/sales.py +23 -13
- sp_api/api/sellers/sellers.py +3 -3
- sp_api/api/services/services.py +41 -30
- sp_api/api/shipping/shipping.py +39 -37
- sp_api/api/shipping/shippingV2.py +46 -30
- sp_api/api/solicitations/solicitations.py +20 -11
- sp_api/api/supply_sources/supply_sources.py +45 -37
- sp_api/api/tokens/tokens.py +4 -6
- sp_api/api/upload/upload.py +10 -8
- sp_api/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +10 -6
- sp_api/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +12 -14
- sp_api/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +4 -6
- sp_api/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +42 -37
- sp_api/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +8 -6
- sp_api/api/vendor_invoices/vendor_invoices.py +6 -4
- sp_api/api/vendor_orders/vendor_orders.py +16 -19
- sp_api/api/vendor_shipments/vendor_shipments.py +91 -262
- sp_api/api/vendor_transaction_status/vendor_transaction_status.py +6 -6
- sp_api/asyncio/api/__init__.py +167 -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/__init__.py +0 -0
- sp_api/asyncio/api/listings_items/listings_items.py +170 -0
- sp_api/asyncio/api/listings_restrictions/__init__.py +0 -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 +412 -0
- sp_api/asyncio/api/orders/orders_2026_01_01.py +40 -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/__init__.py +3 -3
- sp_api/auth/_core.py +39 -0
- sp_api/auth/access_token_client.py +20 -31
- sp_api/auth/access_token_response.py +4 -4
- sp_api/base/ApiResponse.py +5 -4
- sp_api/base/__init__.py +53 -42
- sp_api/base/_core.py +110 -0
- sp_api/base/_transport_httpx.py +39 -0
- sp_api/base/base_client.py +4 -4
- sp_api/base/client.py +131 -112
- sp_api/base/credential_provider.py +41 -34
- sp_api/base/exceptions.py +14 -3
- sp_api/base/feedTypes.py +44 -32
- sp_api/base/fulfillment_channel.py +2 -2
- sp_api/base/helpers.py +17 -16
- sp_api/base/identifiersType.py +8 -8
- sp_api/base/included_data.py +12 -12
- sp_api/base/marketplaces.py +5 -1
- sp_api/base/notifications.py +1 -1
- sp_api/base/processing_status.py +5 -5
- sp_api/base/reportTypes.py +198 -111
- sp_api/base/sales_enum.py +11 -13
- sp_api/util/__init__.py +42 -6
- sp_api/util/key_maker.py +4 -2
- sp_api/util/load_all_pages.py +16 -5
- sp_api/util/load_date_bound.py +28 -13
- 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
- sp_api/util/retry.py +16 -15
- python_amazon_sp_api-1.7.5.dist-info/RECORD +0 -144
- 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.7.5.dist-info → python_amazon_sp_api-2.0.10.dist-info/licenses}/LICENSE +0 -0
- {tests → sp_api/api/application_integrations}/__init__.py +0 -0
- {tests/api → sp_api/api/customer_feedback}/__init__.py +0 -0
- {tests/api/finances → sp_api/api/easy_ship}/__init__.py +0 -0
- {tests/api/notifications → sp_api/api/external_fulfillment}/__init__.py +0 -0
- {tests/api/orders → sp_api/asyncio}/__init__.py +0 -0
- {tests/api/product_fees → sp_api/asyncio/api/feeds}/__init__.py +0 -0
- {tests/api/reports → sp_api/asyncio/api/finances}/__init__.py +0 -0
- {tests/api/sellers → sp_api/asyncio/api/fulfillment_inbound}/__init__.py +0 -0
- {tests/client → sp_api/asyncio/api/fulfillment_outbound}/__init__.py +0 -0
- /tests/api/sellers/test_sellers.py → /sp_api/asyncio/api/inventories/__init__.py +0 -0
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import enum
|
|
4
|
+
from typing import Any, Literal, overload
|
|
5
|
+
|
|
6
|
+
from sp_api.asyncio.base import AsyncBaseClient
|
|
7
|
+
from sp_api.base import ApiResponse, deprecated, fill_query_params, sp_endpoint
|
|
8
|
+
from sp_api.util import normalize_csv_param
|
|
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
|
+
|
|
18
|
+
|
|
19
|
+
class Orders(AsyncBaseClient):
|
|
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
|
+
|
|
28
|
+
:link: https://github.com/amzn/selling-partner-api-docs/tree/main/references/orders-api
|
|
29
|
+
"""
|
|
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
|
+
|
|
60
|
+
@sp_endpoint("/orders/v0/orders")
|
|
61
|
+
async def get_orders(self, **kwargs) -> ApiResponse:
|
|
62
|
+
"""
|
|
63
|
+
get_orders(self, **kwargs) -> ApiResponse
|
|
64
|
+
Returns orders created or updated during the time frame indicated by the specified parameters.
|
|
65
|
+
You can also apply a range of filtering criteria to narrow the list of orders returned.
|
|
66
|
+
If NextToken is present, that will be used to retrieve the orders instead of other criteria.
|
|
67
|
+
|
|
68
|
+
**Usage Plan:**
|
|
69
|
+
|
|
70
|
+
====================================== ==============
|
|
71
|
+
Rate (requests per second) Burst
|
|
72
|
+
====================================== ==============
|
|
73
|
+
1 1
|
|
74
|
+
====================================== ==============
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
78
|
+
|
|
79
|
+
Examples:
|
|
80
|
+
literal blocks::
|
|
81
|
+
|
|
82
|
+
Orders().get_orders(CreatedAfter='TEST_CASE_200', MarketplaceIds=["ATVPDKIKX0DER"])
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
key CreatedAfter: date
|
|
86
|
+
key CreatedBefore: date
|
|
87
|
+
key LastUpdatedAfter: date
|
|
88
|
+
key LastUpdatedBefore: date
|
|
89
|
+
key OrderStatuses: [str]
|
|
90
|
+
key MarketplaceIds: [str]
|
|
91
|
+
key FulfillmentChannels: [str]
|
|
92
|
+
key PaymentMethods: [str]
|
|
93
|
+
key BuyerEmail: str
|
|
94
|
+
key SellerOrderId: str
|
|
95
|
+
key MaxResultsPerPage: int
|
|
96
|
+
key EasyShipShipmentStatuses: [str]
|
|
97
|
+
key NextToken: str
|
|
98
|
+
key AmazonOrderIds: [str]
|
|
99
|
+
key RestrictedResources: [str]
|
|
100
|
+
|
|
101
|
+
Returns:
|
|
102
|
+
ApiResponse:
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
"""
|
|
106
|
+
normalize_csv_param(kwargs, "OrderStatuses")
|
|
107
|
+
normalize_csv_param(kwargs, "MarketplaceIds")
|
|
108
|
+
normalize_csv_param(kwargs, "FulfillmentChannels")
|
|
109
|
+
normalize_csv_param(kwargs, "PaymentMethods")
|
|
110
|
+
normalize_csv_param(kwargs, "AmazonOrderIds")
|
|
111
|
+
|
|
112
|
+
if "RestrictedResources" in kwargs:
|
|
113
|
+
return self._access_restricted(kwargs)
|
|
114
|
+
return await self._request(kwargs.pop("path"), params={**kwargs})
|
|
115
|
+
|
|
116
|
+
@sp_endpoint("/orders/v0/orders/{}")
|
|
117
|
+
async def get_order(self, order_id: str, **kwargs) -> ApiResponse:
|
|
118
|
+
"""
|
|
119
|
+
get_order(self, order_id: str, **kwargs) -> ApiResponse
|
|
120
|
+
Returns the order indicated by the specified order ID.
|
|
121
|
+
|
|
122
|
+
**Usage Plan:**
|
|
123
|
+
|
|
124
|
+
====================================== ==============
|
|
125
|
+
Rate (requests per second) Burst
|
|
126
|
+
====================================== ==============
|
|
127
|
+
1 1
|
|
128
|
+
====================================== ==============
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
132
|
+
|
|
133
|
+
Examples:
|
|
134
|
+
literal blocks::
|
|
135
|
+
|
|
136
|
+
Orders().get_order('TEST_CASE_200')
|
|
137
|
+
|
|
138
|
+
Args:
|
|
139
|
+
order_id: str
|
|
140
|
+
key RestrictedResources: [str]
|
|
141
|
+
**kwargs:
|
|
142
|
+
|
|
143
|
+
Returns:
|
|
144
|
+
ApiResponse:
|
|
145
|
+
|
|
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 await self._request(
|
|
154
|
+
fill_query_params(kwargs.pop("path"), order_id),
|
|
155
|
+
params={**kwargs},
|
|
156
|
+
add_marketplace=False,
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
@sp_endpoint("/orders/v0/orders/{}/orderItems")
|
|
160
|
+
async def get_order_items(self, order_id: str, **kwargs) -> ApiResponse:
|
|
161
|
+
"""
|
|
162
|
+
get_order_items(self, order_id: str, **kwargs) -> ApiResponse
|
|
163
|
+
|
|
164
|
+
Returns detailed order item information for the order indicated by the specified order ID.
|
|
165
|
+
If NextToken is provided, it's used to retrieve the next page of order items.
|
|
166
|
+
|
|
167
|
+
Note: When an order is in the Pending state (the order has been placed but payment has not been authorized),
|
|
168
|
+
the getOrderItems operation does not return information about pricing, taxes, shipping charges, gift status or
|
|
169
|
+
promotions for the order items in the order.
|
|
170
|
+
After an order leaves the Pending state (this occurs when payment has been authorized) and enters the Unshipped,
|
|
171
|
+
Partially Shipped, or Shipped state, the getOrderItems operation returns information about pricing, taxes,
|
|
172
|
+
shipping charges, gift status and promotions for the order items in the order.
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
**Usage Plan:**
|
|
176
|
+
|
|
177
|
+
====================================== ==============
|
|
178
|
+
Rate (requests per second) Burst
|
|
179
|
+
====================================== ==============
|
|
180
|
+
1 1
|
|
181
|
+
====================================== ==============
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
186
|
+
|
|
187
|
+
Examples:
|
|
188
|
+
literal blocks::
|
|
189
|
+
|
|
190
|
+
Orders().get_order_items('TEST_CASE_200')
|
|
191
|
+
|
|
192
|
+
Args:
|
|
193
|
+
order_id: str
|
|
194
|
+
key RestrictedResources: [str]
|
|
195
|
+
**kwargs:
|
|
196
|
+
|
|
197
|
+
Returns:
|
|
198
|
+
ApiResponse:
|
|
199
|
+
|
|
200
|
+
"""
|
|
201
|
+
if "RestrictedResources" in kwargs:
|
|
202
|
+
kwargs.update(
|
|
203
|
+
{"original_path": fill_query_params(kwargs.get("path"), order_id)}
|
|
204
|
+
)
|
|
205
|
+
return self._access_restricted(kwargs)
|
|
206
|
+
return await self._request(
|
|
207
|
+
fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
@sp_endpoint("/orders/v0/orders/{}/address")
|
|
211
|
+
async def get_order_address(self, order_id, **kwargs) -> ApiResponse:
|
|
212
|
+
"""
|
|
213
|
+
get_order_address(self, order_id, **kwargs) -> ApiResponse
|
|
214
|
+
|
|
215
|
+
Returns the shipping address for the order indicated by the specified order ID.
|
|
216
|
+
|
|
217
|
+
:note: To get useful information from this method, you need to have access to PII.
|
|
218
|
+
|
|
219
|
+
**Usage Plan:**
|
|
220
|
+
|
|
221
|
+
====================================== ==============
|
|
222
|
+
Rate (requests per second) Burst
|
|
223
|
+
====================================== ==============
|
|
224
|
+
1 1
|
|
225
|
+
====================================== ==============
|
|
226
|
+
|
|
227
|
+
Examples:
|
|
228
|
+
Orders().get_order_address('TEST_CASE_200')
|
|
229
|
+
|
|
230
|
+
Args:
|
|
231
|
+
order_id: str
|
|
232
|
+
**kwargs:
|
|
233
|
+
|
|
234
|
+
Returns:
|
|
235
|
+
ApiResponse
|
|
236
|
+
"""
|
|
237
|
+
return await self._request(
|
|
238
|
+
fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
|
|
239
|
+
)
|
|
240
|
+
|
|
241
|
+
@sp_endpoint("/orders/v0/orders/{}/buyerInfo")
|
|
242
|
+
async def get_order_buyer_info(self, order_id: str, **kwargs) -> ApiResponse:
|
|
243
|
+
"""
|
|
244
|
+
get_order_buyer_info(self, order_id: str, **kwargs) -> ApiResponse
|
|
245
|
+
Returns buyer information for the order indicated by the specified order ID.
|
|
246
|
+
|
|
247
|
+
:note: To get useful information from this method, you need to have access to PII.
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
**Usage Plan:**
|
|
251
|
+
|
|
252
|
+
====================================== ==============
|
|
253
|
+
Rate (requests per second) Burst
|
|
254
|
+
====================================== ==============
|
|
255
|
+
1 1
|
|
256
|
+
====================================== ==============
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
260
|
+
|
|
261
|
+
Examples:
|
|
262
|
+
Orders().get_order_buyer_info('TEST_CASE_200')
|
|
263
|
+
|
|
264
|
+
Args:
|
|
265
|
+
order_id: str
|
|
266
|
+
**kwargs:
|
|
267
|
+
|
|
268
|
+
Returns:
|
|
269
|
+
GetOrderBuyerInfoResponse:
|
|
270
|
+
|
|
271
|
+
"""
|
|
272
|
+
return await self._request(
|
|
273
|
+
fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
@sp_endpoint("/orders/v0/orders/{}/orderItems/buyerInfo")
|
|
277
|
+
async def get_order_items_buyer_info(self, order_id: str, **kwargs) -> ApiResponse:
|
|
278
|
+
"""
|
|
279
|
+
get_order_items_buyer_info(self, order_id: str, **kwargs) -> ApiResponse
|
|
280
|
+
|
|
281
|
+
Returns buyer information in the order items of the order indicated by the specified order ID.
|
|
282
|
+
|
|
283
|
+
**Usage Plan:**
|
|
284
|
+
|
|
285
|
+
====================================== ==============
|
|
286
|
+
Rate (requests per second) Burst
|
|
287
|
+
====================================== ==============
|
|
288
|
+
1 1
|
|
289
|
+
====================================== ==============
|
|
290
|
+
|
|
291
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
292
|
+
|
|
293
|
+
Examples:
|
|
294
|
+
literal blocks::
|
|
295
|
+
|
|
296
|
+
Orders().get_order_items_buyer_info('TEST_CASE_200')
|
|
297
|
+
|
|
298
|
+
Args:
|
|
299
|
+
order_id: str
|
|
300
|
+
key NextToken: str | retrieve data by next token
|
|
301
|
+
|
|
302
|
+
Returns:
|
|
303
|
+
ApiResponse
|
|
304
|
+
"""
|
|
305
|
+
return await self._request(
|
|
306
|
+
fill_query_params(kwargs.pop("path"), order_id), params=kwargs
|
|
307
|
+
)
|
|
308
|
+
|
|
309
|
+
@sp_endpoint("/orders/v0/orders/{}/shipment", method="POST")
|
|
310
|
+
async def update_shipment_status(self, order_id: str, **kwargs) -> ApiResponse:
|
|
311
|
+
"""
|
|
312
|
+
update_shipment_status(self, order_id: str, **kwargs) -> ApiResponse
|
|
313
|
+
Update the shipment status.
|
|
314
|
+
**Usage Plan:**
|
|
315
|
+
====================================== ==============
|
|
316
|
+
Rate (requests per second) Burst
|
|
317
|
+
====================================== ==============
|
|
318
|
+
5 15
|
|
319
|
+
====================================== ==============
|
|
320
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
321
|
+
Examples:
|
|
322
|
+
literal blocks::
|
|
323
|
+
Orders().update_shipment_status(
|
|
324
|
+
order_id='123-1234567-1234567',
|
|
325
|
+
marketplaceId='ATVPDKIKX0DER',
|
|
326
|
+
shipmentStatus='ReadyForPickup'
|
|
327
|
+
)
|
|
328
|
+
Args:
|
|
329
|
+
order_id: str
|
|
330
|
+
Returns:
|
|
331
|
+
ApiResponse
|
|
332
|
+
"""
|
|
333
|
+
return await self._request(
|
|
334
|
+
fill_query_params(kwargs.pop("path"), order_id),
|
|
335
|
+
res_no_data=True,
|
|
336
|
+
data=kwargs,
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
@sp_endpoint("/orders/v0/orders/{}/shipmentConfirmation", method="POST")
|
|
340
|
+
async def confirm_shipment(self, order_id: str, **kwargs) -> ApiResponse:
|
|
341
|
+
"""
|
|
342
|
+
confirm_shipment(self, order_id: str, **kwargs) -> ApiResponse
|
|
343
|
+
Updates the shipment confirmation status for a specified order.
|
|
344
|
+
**Usage Plan:**
|
|
345
|
+
====================================== ==============
|
|
346
|
+
Rate (requests per second) Burst
|
|
347
|
+
====================================== ==============
|
|
348
|
+
2 10
|
|
349
|
+
====================================== ==============
|
|
350
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
351
|
+
Examples:
|
|
352
|
+
literal blocks::
|
|
353
|
+
Orders().confirm_shipment(
|
|
354
|
+
order_id='123-1234567-1234567',
|
|
355
|
+
marketplaceId='ATVPDKIKX0DER',
|
|
356
|
+
packageDetail={
|
|
357
|
+
'packageReferenceId': '0001',
|
|
358
|
+
'carrierCode': 'DHL',
|
|
359
|
+
"shippingMethod": 'Paket',
|
|
360
|
+
'trackingNumber': '1234567890',
|
|
361
|
+
'shipDate': '2023-03-19T12:00:00Z',
|
|
362
|
+
'orderItems': [
|
|
363
|
+
{
|
|
364
|
+
'orderItemId': '123456789',
|
|
365
|
+
'quantity': 1
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
'orderItemId': '2345678901',
|
|
369
|
+
'quantity': 2
|
|
370
|
+
},
|
|
371
|
+
]
|
|
372
|
+
}
|
|
373
|
+
)
|
|
374
|
+
Args:
|
|
375
|
+
order_id: str
|
|
376
|
+
Returns:
|
|
377
|
+
ApiResponse
|
|
378
|
+
"""
|
|
379
|
+
return await self._request(
|
|
380
|
+
fill_query_params(kwargs.pop("path"), order_id),
|
|
381
|
+
add_marketplace=False,
|
|
382
|
+
res_no_data=True,
|
|
383
|
+
data=kwargs,
|
|
384
|
+
)
|
|
385
|
+
|
|
386
|
+
@sp_endpoint("/tokens/2021-03-01/restrictedDataToken", method="POST")
|
|
387
|
+
async def _get_token(self, **kwargs):
|
|
388
|
+
data_elements = kwargs.pop("RestrictedResources")
|
|
389
|
+
|
|
390
|
+
restricted_resources = [
|
|
391
|
+
{
|
|
392
|
+
"method": "GET",
|
|
393
|
+
"path": kwargs.get("original_path"),
|
|
394
|
+
"dataElements": data_elements,
|
|
395
|
+
}
|
|
396
|
+
]
|
|
397
|
+
|
|
398
|
+
return await self._request(
|
|
399
|
+
kwargs.pop("path"),
|
|
400
|
+
data={"restrictedResources": restricted_resources, **kwargs},
|
|
401
|
+
)
|
|
402
|
+
|
|
403
|
+
async def _access_restricted(self, kwargs):
|
|
404
|
+
if "original_path" not in kwargs:
|
|
405
|
+
kwargs.update({"original_path": kwargs["path"]})
|
|
406
|
+
token = self._get_token(**kwargs).payload
|
|
407
|
+
self.restricted_data_token = token["restrictedDataToken"]
|
|
408
|
+
r = await self._request(kwargs.pop("original_path"), params={**kwargs})
|
|
409
|
+
if not self.keep_restricted_data_token:
|
|
410
|
+
self.restricted_data_token = None
|
|
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
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
from urllib.parse import quote_plus
|
|
3
|
+
|
|
4
|
+
from sp_api.base.helpers import sp_endpoint, fill_query_params
|
|
5
|
+
from sp_api.base import ApiResponse
|
|
6
|
+
from sp_api.asyncio.base import AsyncBaseClient
|
|
7
|
+
from sp_api.util.product_fees import create_fees_body
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ProductFees(AsyncBaseClient):
|
|
11
|
+
"""
|
|
12
|
+
:link: https://github.com/amzn/selling-partner-api-docs/tree/main/references/product-fees-api
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
@sp_endpoint("/products/fees/v0/listings/{}/feesEstimate", method="POST")
|
|
16
|
+
async def get_product_fees_estimate_for_sku(
|
|
17
|
+
self,
|
|
18
|
+
seller_sku,
|
|
19
|
+
price: float,
|
|
20
|
+
shipping_price=None,
|
|
21
|
+
currency="USD",
|
|
22
|
+
is_fba=False,
|
|
23
|
+
points: dict = None,
|
|
24
|
+
marketplace_id: str = None,
|
|
25
|
+
optional_fulfillment_program: str = None,
|
|
26
|
+
force_safe_sku: bool = True,
|
|
27
|
+
**kwargs
|
|
28
|
+
) -> ApiResponse:
|
|
29
|
+
"""
|
|
30
|
+
get_product_fees_estimate_for_sku(self, seller_sku, price: float, shipping_price=None, currency='USD', is_fba=False, points: dict = dict, **kwargs) -> ApiResponse
|
|
31
|
+
|
|
32
|
+
Returns fees for sku
|
|
33
|
+
|
|
34
|
+
Examples:
|
|
35
|
+
literal blocks::
|
|
36
|
+
|
|
37
|
+
ProductFees().get_product_fees_estimate_for_sku("UmaS1", 10, currency='USD', shipping_price=10, is_fba=False,
|
|
38
|
+
points={
|
|
39
|
+
"PointsNumber": 0,
|
|
40
|
+
"PointsMonetaryValue": {
|
|
41
|
+
"CurrencyCode": "USD",
|
|
42
|
+
"Amount": 0
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
seller_sku:
|
|
48
|
+
price:
|
|
49
|
+
shipping_price:
|
|
50
|
+
currency:
|
|
51
|
+
is_fba:
|
|
52
|
+
points:
|
|
53
|
+
marketplace_id: str | Defaults to self.marketplace_id
|
|
54
|
+
optional_fulfillment_program:
|
|
55
|
+
force_safe_sku: bool | Force user SKU quote
|
|
56
|
+
**kwargs:
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
ApiResponse:
|
|
60
|
+
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
if force_safe_sku:
|
|
64
|
+
# handle `forward slash` issue in SKU
|
|
65
|
+
seller_sku = quote_plus(seller_sku)
|
|
66
|
+
|
|
67
|
+
kwargs.update(
|
|
68
|
+
create_fees_body(
|
|
69
|
+
price=price,
|
|
70
|
+
shipping_price=shipping_price,
|
|
71
|
+
currency=currency,
|
|
72
|
+
is_fba=is_fba,
|
|
73
|
+
identifier=seller_sku,
|
|
74
|
+
points=points,
|
|
75
|
+
marketplace_id=marketplace_id or self.marketplace_id,
|
|
76
|
+
optional_fulfillment_program=optional_fulfillment_program,
|
|
77
|
+
)
|
|
78
|
+
)
|
|
79
|
+
return await self._request(
|
|
80
|
+
fill_query_params(kwargs.pop("path"), seller_sku), data=kwargs
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
@sp_endpoint("/products/fees/v0/items/{}/feesEstimate", method="POST")
|
|
84
|
+
async def get_product_fees_estimate_for_asin(
|
|
85
|
+
self,
|
|
86
|
+
asin,
|
|
87
|
+
price: float,
|
|
88
|
+
currency="USD",
|
|
89
|
+
shipping_price=None,
|
|
90
|
+
is_fba=False,
|
|
91
|
+
points: dict = None,
|
|
92
|
+
marketplace_id: str = None,
|
|
93
|
+
optional_fulfillment_program: str = None,
|
|
94
|
+
**kwargs
|
|
95
|
+
) -> ApiResponse:
|
|
96
|
+
"""
|
|
97
|
+
get_product_fees_estimate_for_asin(self, asin, price: float, currency='USD', shipping_price=None, is_fba=False, points: dict = dict, **kwargs) -> ApiResponse
|
|
98
|
+
|
|
99
|
+
Returns fees for asin
|
|
100
|
+
|
|
101
|
+
Examples:
|
|
102
|
+
literal blocks::
|
|
103
|
+
|
|
104
|
+
ProductFees().get_product_fees_estimate_for_asin("UmaS1", 10, currency='USD', shipping_price=10, is_fba=False,
|
|
105
|
+
points={
|
|
106
|
+
"PointsNumber": 0,
|
|
107
|
+
"PointsMonetaryValue": {
|
|
108
|
+
"CurrencyCode": "USD",
|
|
109
|
+
"Amount": 0
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
Args:
|
|
114
|
+
asin:
|
|
115
|
+
price:
|
|
116
|
+
currency:
|
|
117
|
+
shipping_price:
|
|
118
|
+
is_fba:
|
|
119
|
+
points:
|
|
120
|
+
marketplace_id: str | Defaults to self.marketplace_id
|
|
121
|
+
optional_fulfillment_program:
|
|
122
|
+
**kwargs:
|
|
123
|
+
|
|
124
|
+
Returns:
|
|
125
|
+
ApiResponse:
|
|
126
|
+
|
|
127
|
+
"""
|
|
128
|
+
kwargs.update(
|
|
129
|
+
create_fees_body(
|
|
130
|
+
price=price,
|
|
131
|
+
shipping_price=shipping_price,
|
|
132
|
+
currency=currency,
|
|
133
|
+
is_fba=is_fba,
|
|
134
|
+
identifier=asin,
|
|
135
|
+
points=points,
|
|
136
|
+
marketplace_id=marketplace_id or self.marketplace_id,
|
|
137
|
+
optional_fulfillment_program=optional_fulfillment_program,
|
|
138
|
+
)
|
|
139
|
+
)
|
|
140
|
+
return await self._request(fill_query_params(kwargs.pop("path"), asin), data=kwargs)
|
|
141
|
+
|
|
142
|
+
async def get_product_fees_estimate(self, estimate_requests: List[dict]) -> ApiResponse:
|
|
143
|
+
"""
|
|
144
|
+
get_product_fees_estimate(self, estimate_requests: List[dict]) -> ApiResponse
|
|
145
|
+
|
|
146
|
+
Return fees for multiple products
|
|
147
|
+
|
|
148
|
+
Examples:
|
|
149
|
+
literal blocks::
|
|
150
|
+
|
|
151
|
+
ProductFees().get_product_fees_estimate(
|
|
152
|
+
[
|
|
153
|
+
dict(id_type='ASIN', id_value='B012345678', price=100),
|
|
154
|
+
dict(id_type='ASIN', id_value='B012345678', price=50, is_fba=True),
|
|
155
|
+
]
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
Args:
|
|
160
|
+
estimate_requests: list of dict where the allowed keys are :
|
|
161
|
+
id_type: str | ASIN or SellerSKU
|
|
162
|
+
id_value: str
|
|
163
|
+
price:
|
|
164
|
+
currency:
|
|
165
|
+
shipping_price:
|
|
166
|
+
is_fba:
|
|
167
|
+
points:
|
|
168
|
+
marketplace_id: str | Defaults to self.marketplace_id
|
|
169
|
+
optional_fulfillment_program:
|
|
170
|
+
"""
|
|
171
|
+
data = []
|
|
172
|
+
for estimate in estimate_requests:
|
|
173
|
+
estimate_payload = dict(estimate)
|
|
174
|
+
marketplace_id = estimate_payload.pop("marketplace_id", None)
|
|
175
|
+
data.append(
|
|
176
|
+
dict(
|
|
177
|
+
**create_fees_body(
|
|
178
|
+
marketplace_id=marketplace_id or self.marketplace_id,
|
|
179
|
+
**estimate_payload,
|
|
180
|
+
)
|
|
181
|
+
)
|
|
182
|
+
)
|
|
183
|
+
return await self._request(
|
|
184
|
+
"/products/fees/v0/feesEstimate",
|
|
185
|
+
data=data,
|
|
186
|
+
params=dict(method="POST"),
|
|
187
|
+
wrap_list=True,
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
def _add_marketplaces(self, data):
|
|
191
|
+
# MarketplaceID is a property of the body's FeesEstimateRequest for this section, and does
|
|
192
|
+
# not need to be added. Additionally, Client._add_marketplaces will fail as it assumes
|
|
193
|
+
# data is a dict, which is not the case for get_product_fees_estimate.
|
|
194
|
+
pass
|
|
File without changes
|