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
sp_api/api/products/products.py
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
from typing import Optional, List, Dict, Union
|
|
2
2
|
|
|
3
3
|
from sp_api.base import ApiResponse, Client, fill_query_params, sp_endpoint
|
|
4
|
-
from sp_api.api.products.products_definitions import
|
|
4
|
+
from sp_api.api.products.products_definitions import (
|
|
5
|
+
GetCompetitiveSummaryBatch,
|
|
6
|
+
GetFeaturedOfferExpectedPriceBatch,
|
|
7
|
+
GetItemOffersBatchRequest,
|
|
8
|
+
GetListingOffersBatchRequest,
|
|
9
|
+
)
|
|
10
|
+
from sp_api.util import ensure_csv
|
|
5
11
|
|
|
6
12
|
|
|
7
13
|
class Products(Client):
|
|
8
14
|
"""
|
|
9
|
-
:
|
|
15
|
+
:links:
|
|
16
|
+
https://github.com/amzn/selling-partner-api-docs/blob/main/references/product-pricing-api/productPricingV0.md
|
|
17
|
+
https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v2022-05-01-reference
|
|
10
18
|
"""
|
|
11
19
|
|
|
12
|
-
@sp_endpoint(
|
|
13
|
-
def get_product_pricing_for_skus(
|
|
20
|
+
@sp_endpoint("/products/pricing/v0/price", method="GET")
|
|
21
|
+
def get_product_pricing_for_skus(
|
|
22
|
+
self, seller_sku_list: [str], item_condition=None, offer_type=None, **kwargs
|
|
23
|
+
) -> ApiResponse:
|
|
14
24
|
"""
|
|
15
25
|
get_product_pricing_for_skus(self, seller_sku_list: [str], item_condition: str = None, **kwargs) -> ApiResponse
|
|
16
26
|
Returns pricing information for a seller's offer listings based on SKU.
|
|
@@ -38,14 +48,16 @@ class Products(Client):
|
|
|
38
48
|
ApiResponse:
|
|
39
49
|
"""
|
|
40
50
|
if item_condition is not None:
|
|
41
|
-
kwargs[
|
|
51
|
+
kwargs["ItemCondition"] = item_condition
|
|
42
52
|
if offer_type is not None:
|
|
43
|
-
kwargs[
|
|
53
|
+
kwargs["OfferType"] = offer_type
|
|
44
54
|
|
|
45
|
-
return self._create_get_pricing_request(seller_sku_list,
|
|
55
|
+
return self._create_get_pricing_request(seller_sku_list, "Sku", **kwargs)
|
|
46
56
|
|
|
47
|
-
@sp_endpoint(
|
|
48
|
-
def get_product_pricing_for_asins(
|
|
57
|
+
@sp_endpoint("/products/pricing/v0/price", method="GET")
|
|
58
|
+
def get_product_pricing_for_asins(
|
|
59
|
+
self, asin_list: [str], item_condition=None, offer_type=None, **kwargs
|
|
60
|
+
) -> ApiResponse:
|
|
49
61
|
"""
|
|
50
62
|
get_product_pricing_for_asins(self, asin_list: [str], item_condition=None, **kwargs) -> ApiResponse
|
|
51
63
|
Returns pricing information for a seller's offer listings based on ASIN.
|
|
@@ -71,14 +83,16 @@ class Products(Client):
|
|
|
71
83
|
ApiResponse
|
|
72
84
|
"""
|
|
73
85
|
if item_condition is not None:
|
|
74
|
-
kwargs[
|
|
86
|
+
kwargs["ItemCondition"] = item_condition
|
|
75
87
|
if offer_type is not None:
|
|
76
|
-
kwargs[
|
|
88
|
+
kwargs["OfferType"] = offer_type
|
|
77
89
|
|
|
78
|
-
return self._create_get_pricing_request(asin_list,
|
|
90
|
+
return self._create_get_pricing_request(asin_list, "Asin", **kwargs)
|
|
79
91
|
|
|
80
|
-
@sp_endpoint(
|
|
81
|
-
def get_competitive_pricing_for_skus(
|
|
92
|
+
@sp_endpoint("/products/pricing/v0/competitivePrice", method="GET")
|
|
93
|
+
def get_competitive_pricing_for_skus(
|
|
94
|
+
self, seller_sku_list: [str], customer_type=None, **kwargs
|
|
95
|
+
) -> ApiResponse:
|
|
82
96
|
"""
|
|
83
97
|
get_competitive_pricing_for_skus(self, seller_sku_list, **kwargs) -> ApiResponse
|
|
84
98
|
Returns competitive pricing information for a seller's offer listings based on Seller Sku
|
|
@@ -105,12 +119,14 @@ class Products(Client):
|
|
|
105
119
|
"""
|
|
106
120
|
|
|
107
121
|
if customer_type is not None:
|
|
108
|
-
kwargs[
|
|
122
|
+
kwargs["CustomerType"] = customer_type
|
|
109
123
|
|
|
110
|
-
return self._create_get_pricing_request(seller_sku_list,
|
|
124
|
+
return self._create_get_pricing_request(seller_sku_list, "Sku", **kwargs)
|
|
111
125
|
|
|
112
|
-
@sp_endpoint(
|
|
113
|
-
def get_competitive_pricing_for_asins(
|
|
126
|
+
@sp_endpoint("/products/pricing/v0/competitivePrice", method="GET")
|
|
127
|
+
def get_competitive_pricing_for_asins(
|
|
128
|
+
self, asin_list: [str], customer_type=None, **kwargs
|
|
129
|
+
) -> ApiResponse:
|
|
114
130
|
"""
|
|
115
131
|
get_competitive_pricing_for_asins(self, asin_list, **kwargs) -> ApiResponse
|
|
116
132
|
Returns competitive pricing information for a seller's offer listings based on ASIN
|
|
@@ -137,12 +153,14 @@ class Products(Client):
|
|
|
137
153
|
|
|
138
154
|
"""
|
|
139
155
|
if customer_type is not None:
|
|
140
|
-
kwargs[
|
|
156
|
+
kwargs["CustomerType"] = customer_type
|
|
141
157
|
|
|
142
|
-
return self._create_get_pricing_request(asin_list,
|
|
158
|
+
return self._create_get_pricing_request(asin_list, "Asin", **kwargs)
|
|
143
159
|
|
|
144
|
-
@sp_endpoint(
|
|
145
|
-
def get_listings_offer(
|
|
160
|
+
@sp_endpoint("/products/pricing/v0/listings/{}/offers", method="GET")
|
|
161
|
+
def get_listings_offer(
|
|
162
|
+
self, seller_sku: str, item_condition: str, customer_type: str = None, **kwargs
|
|
163
|
+
) -> ApiResponse:
|
|
146
164
|
"""
|
|
147
165
|
get_listings_offer(self, seller_sku: str, **kwargs) -> ApiResponse
|
|
148
166
|
Returns the lowest priced offers for a single SKU listing
|
|
@@ -166,15 +184,19 @@ class Products(Client):
|
|
|
166
184
|
ApiResponse
|
|
167
185
|
|
|
168
186
|
"""
|
|
169
|
-
kwargs[
|
|
187
|
+
kwargs["ItemCondition"] = item_condition
|
|
170
188
|
|
|
171
189
|
if customer_type is not None:
|
|
172
|
-
kwargs[
|
|
190
|
+
kwargs["CustomerType"] = customer_type
|
|
173
191
|
|
|
174
|
-
return self._request(
|
|
192
|
+
return self._request(
|
|
193
|
+
fill_query_params(kwargs.pop("path"), seller_sku), params={**kwargs}
|
|
194
|
+
)
|
|
175
195
|
|
|
176
|
-
@sp_endpoint(
|
|
177
|
-
def get_item_offers(
|
|
196
|
+
@sp_endpoint("/products/pricing/v0/items/{}/offers", method="GET")
|
|
197
|
+
def get_item_offers(
|
|
198
|
+
self, asin: str, item_condition: str, customer_type: str = None, **kwargs
|
|
199
|
+
) -> ApiResponse:
|
|
178
200
|
"""
|
|
179
201
|
get_item_offers(self, asin: str, **kwargs) -> ApiResponse
|
|
180
202
|
Returns the lowest priced offers for a single item based on ASIN
|
|
@@ -198,16 +220,21 @@ class Products(Client):
|
|
|
198
220
|
ApiResponse
|
|
199
221
|
|
|
200
222
|
"""
|
|
201
|
-
kwargs[
|
|
223
|
+
kwargs["ItemCondition"] = item_condition
|
|
202
224
|
|
|
203
225
|
if customer_type is not None:
|
|
204
|
-
kwargs[
|
|
205
|
-
|
|
206
|
-
return self._request(
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
226
|
+
kwargs["CustomerType"] = customer_type
|
|
227
|
+
|
|
228
|
+
return self._request(
|
|
229
|
+
fill_query_params(kwargs.pop("path"), asin), params={**kwargs}
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
@sp_endpoint("/batches/products/pricing/v0/itemOffers", method="POST")
|
|
233
|
+
def get_item_offers_batch(
|
|
234
|
+
self,
|
|
235
|
+
requests_: Optional[Union[List[Dict], GetItemOffersBatchRequest]] = None,
|
|
236
|
+
**kwargs,
|
|
237
|
+
) -> ApiResponse:
|
|
211
238
|
"""
|
|
212
239
|
get_item_offers_batch(self, requests_: Optional[List[Union[Dict, ItemOffersRequest]]], **kwargs) -> ApiResponse
|
|
213
240
|
Returns the lowest priced offers for a batch of items based on ASIN.
|
|
@@ -233,11 +260,19 @@ class Products(Client):
|
|
|
233
260
|
else:
|
|
234
261
|
get_item_offers_batch_request = {"requests": requests_}
|
|
235
262
|
|
|
236
|
-
return self._request(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
263
|
+
return self._request(
|
|
264
|
+
kwargs.pop("path"),
|
|
265
|
+
data=get_item_offers_batch_request,
|
|
266
|
+
params={**kwargs},
|
|
267
|
+
add_marketplace=False,
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
@sp_endpoint("/batches/products/pricing/v0/listingOffers", method="POST")
|
|
271
|
+
def get_listing_offers_batch(
|
|
272
|
+
self,
|
|
273
|
+
requests_: Optional[Union[List[Dict], GetListingOffersBatchRequest]] = None,
|
|
274
|
+
**kwargs,
|
|
275
|
+
) -> ApiResponse:
|
|
241
276
|
"""
|
|
242
277
|
get_listing_offers_batch(self, requests_: Optional[Union[List[Dict], GetListingOffersBatchRequest]], **kwargs) -> ApiResponse
|
|
243
278
|
Returns the lowest priced offers for a batch of listings based on ASIN.
|
|
@@ -263,18 +298,107 @@ class Products(Client):
|
|
|
263
298
|
else:
|
|
264
299
|
get_listing_offers_batch_request = {"requests": requests_}
|
|
265
300
|
|
|
266
|
-
return self._request(
|
|
267
|
-
|
|
301
|
+
return self._request(
|
|
302
|
+
kwargs.pop("path"),
|
|
303
|
+
data=get_listing_offers_batch_request,
|
|
304
|
+
params={**kwargs},
|
|
305
|
+
add_marketplace=False,
|
|
306
|
+
)
|
|
268
307
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
308
|
+
@sp_endpoint('/batches/products/pricing/2022-05-01/offer/featuredOfferExpectedPrice', method='POST')
|
|
309
|
+
def get_featured_offer_expected_price_batch(self, requests_: Optional[
|
|
310
|
+
Union[List[Dict], GetFeaturedOfferExpectedPriceBatch]], **kwargs) -> ApiResponse:
|
|
311
|
+
"""
|
|
312
|
+
get_featured_offer_expected_price_batch(self, **kwargs) -> ApiResponse
|
|
313
|
+
|
|
314
|
+
Returns the set of responses that correspond to the batched list of up to 40 requests defined in the request
|
|
315
|
+
body. The response for each successful (HTTP status code 200) request in the set includes the computed listing
|
|
316
|
+
price at or below which a seller can expect to become the featured offer (before applicable promotions).
|
|
317
|
+
This is called the featured offer expected price (FOEP). Featured offer is not guaranteed, because competing
|
|
318
|
+
offers may change, and different offers may be featured based on other factors, including fulfillment
|
|
319
|
+
capabilities to a specific customer. The response to an unsuccessful request includes the available error text.
|
|
320
|
+
|
|
321
|
+
**Usage Plan:**
|
|
322
|
+
|
|
323
|
+
====================================== ==============
|
|
324
|
+
Rate (requests per second) Burst
|
|
325
|
+
====================================== ==============
|
|
326
|
+
.033 1
|
|
327
|
+
====================================== ==============
|
|
328
|
+
|
|
329
|
+
Args:
|
|
330
|
+
requests_: [dict] The request associated with the getFeaturedOfferExpectedPriceBatch API call.
|
|
331
|
+
|
|
332
|
+
Returns:
|
|
333
|
+
ApiResponse:
|
|
334
|
+
"""
|
|
335
|
+
if isinstance(requests_, GetFeaturedOfferExpectedPriceBatch):
|
|
336
|
+
get_featured_offer_expected_price_batch_request = requests_.to_dict()
|
|
337
|
+
else:
|
|
338
|
+
get_featured_offer_expected_price_batch_request = {"requests": requests_}
|
|
280
339
|
|
|
340
|
+
return self._request(
|
|
341
|
+
kwargs.pop('path'),
|
|
342
|
+
data=get_featured_offer_expected_price_batch_request,
|
|
343
|
+
params={**kwargs},
|
|
344
|
+
add_marketplace=False
|
|
345
|
+
)
|
|
346
|
+
|
|
347
|
+
@sp_endpoint('/batches/products/pricing/2022-05-01/items/competitiveSummary', method='POST')
|
|
348
|
+
def get_competitive_summary_batch(self, requests_: Optional[Union[List[Dict], GetCompetitiveSummaryBatch]], **kwargs) -> ApiResponse:
|
|
349
|
+
"""
|
|
350
|
+
get_competitive_summary(self, **kwargs) -> ApiResponse
|
|
351
|
+
|
|
352
|
+
Returns the competitive summary response including featured buying options for the ASIN and `marketplaceId` combination.
|
|
353
|
+
|
|
354
|
+
**Usage Plan:**
|
|
355
|
+
|
|
356
|
+
====================================== ==============
|
|
357
|
+
Rate (requests per second) Burst
|
|
358
|
+
====================================== ==============
|
|
359
|
+
.033 1
|
|
360
|
+
====================================== ==============
|
|
361
|
+
|
|
362
|
+
Args:
|
|
363
|
+
requests_: The request associated with the getCompetitiveSummary API call.
|
|
364
|
+
|
|
365
|
+
Returns:
|
|
366
|
+
ApiResponse:
|
|
367
|
+
"""
|
|
368
|
+
if isinstance(requests_, GetCompetitiveSummaryBatch):
|
|
369
|
+
get_competitive_summary_batch_request = requests_.to_dict()
|
|
370
|
+
else:
|
|
371
|
+
get_competitive_summary_batch_request = {"requests": requests_}
|
|
372
|
+
|
|
373
|
+
return self._request(
|
|
374
|
+
kwargs.pop('path'),
|
|
375
|
+
data=get_competitive_summary_batch_request,
|
|
376
|
+
params={**kwargs},
|
|
377
|
+
add_marketplace=False
|
|
378
|
+
)
|
|
379
|
+
|
|
380
|
+
def _create_get_pricing_request(self, item_list, item_type, **kwargs):
|
|
381
|
+
items_csv = ensure_csv(item_list)
|
|
382
|
+
return self._request(
|
|
383
|
+
kwargs.pop("path"),
|
|
384
|
+
params={
|
|
385
|
+
**{f"{item_type}s": items_csv},
|
|
386
|
+
"ItemType": item_type,
|
|
387
|
+
**(
|
|
388
|
+
{"ItemCondition": kwargs.pop("ItemCondition")}
|
|
389
|
+
if "ItemCondition" in kwargs
|
|
390
|
+
else {}
|
|
391
|
+
),
|
|
392
|
+
**(
|
|
393
|
+
{"CustomerType": kwargs.pop("CustomerType")}
|
|
394
|
+
if "CustomerType" in kwargs
|
|
395
|
+
else {}
|
|
396
|
+
),
|
|
397
|
+
**(
|
|
398
|
+
{"OfferType": kwargs.pop("OfferType")}
|
|
399
|
+
if "OfferType" in kwargs
|
|
400
|
+
else {}
|
|
401
|
+
),
|
|
402
|
+
"MarketplaceId": kwargs.get("MarketplaceId", self.marketplace_id),
|
|
403
|
+
},
|
|
404
|
+
)
|
|
@@ -1,82 +1,11 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
ItemCondition: str = None
|
|
13
|
-
CustomerType: str = None
|
|
14
|
-
headers: Dict = None
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@dataclass
|
|
18
|
-
class GetItemOffersBatchRequest:
|
|
19
|
-
""" Implements definition: https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v0-reference
|
|
20
|
-
#getitemoffersbatchrequest """
|
|
21
|
-
requests: Optional[List[Union[ItemOffersRequest, Dict]]] = None
|
|
22
|
-
|
|
23
|
-
def __post_init__(self):
|
|
24
|
-
self.requests = self.parse_requests(self.requests)
|
|
25
|
-
|
|
26
|
-
def to_dict(self):
|
|
27
|
-
return asdict(self)
|
|
28
|
-
|
|
29
|
-
@staticmethod
|
|
30
|
-
def parse_requests(requests) -> List[ItemOffersRequest]:
|
|
31
|
-
parsed_requestes = []
|
|
32
|
-
|
|
33
|
-
for request in requests:
|
|
34
|
-
if isinstance(request, Dict):
|
|
35
|
-
request = ItemOffersRequest(**request)
|
|
36
|
-
|
|
37
|
-
if not isinstance(request, ItemOffersRequest):
|
|
38
|
-
raise TypeError
|
|
39
|
-
|
|
40
|
-
parsed_requestes.append(request)
|
|
41
|
-
|
|
42
|
-
return parsed_requestes
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
@dataclass
|
|
46
|
-
class ListingOffersRequest:
|
|
47
|
-
""" Implements definition: https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v0-reference
|
|
48
|
-
#listingoffersrequest """
|
|
49
|
-
uri: str
|
|
50
|
-
MarketplaceId: str
|
|
51
|
-
ItemCondition: str
|
|
52
|
-
method: str = "GET"
|
|
53
|
-
CustomerType: str = "Consumer"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
@dataclass
|
|
57
|
-
class GetListingOffersBatchRequest:
|
|
58
|
-
""" Implements definition: https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v0-reference
|
|
59
|
-
#getlistingoffersbatchrequest """
|
|
60
|
-
requests: Optional[List[Union[ListingOffersRequest, Dict]]] = None
|
|
61
|
-
|
|
62
|
-
def __post_init__(self):
|
|
63
|
-
self.requests = self.parse_requests(self.requests)
|
|
64
|
-
|
|
65
|
-
def to_dict(self):
|
|
66
|
-
return asdict(self)
|
|
67
|
-
|
|
68
|
-
@staticmethod
|
|
69
|
-
def parse_requests(requests) -> List[ListingOffersRequest]:
|
|
70
|
-
parsed_requestes = []
|
|
71
|
-
|
|
72
|
-
for request in requests:
|
|
73
|
-
if isinstance(request, Dict):
|
|
74
|
-
request = ListingOffersRequest(**request)
|
|
75
|
-
|
|
76
|
-
if not isinstance(request, ListingOffersRequest):
|
|
77
|
-
raise TypeError
|
|
78
|
-
|
|
79
|
-
parsed_requestes.append(request)
|
|
80
|
-
|
|
81
|
-
return parsed_requestes
|
|
82
|
-
|
|
1
|
+
from sp_api.util.products_definitions import (
|
|
2
|
+
CompetitiveSummaryIncludedData,
|
|
3
|
+
ItemOffersRequest,
|
|
4
|
+
GetItemOffersBatchRequest,
|
|
5
|
+
ListingOffersRequest,
|
|
6
|
+
GetListingOffersBatchRequest,
|
|
7
|
+
FeaturedOfferExpectedPriceRequest,
|
|
8
|
+
GetFeaturedOfferExpectedPriceBatch,
|
|
9
|
+
CompetitiveSummaryRequest,
|
|
10
|
+
GetCompetitiveSummaryBatch,
|
|
11
|
+
)
|
|
@@ -6,19 +6,21 @@ from sp_api.base import Client, sp_endpoint, fill_query_params, ApiResponse
|
|
|
6
6
|
class Replenishment(Client):
|
|
7
7
|
"""
|
|
8
8
|
Replenishment SP-API Client
|
|
9
|
-
:link:
|
|
9
|
+
:link:
|
|
10
10
|
|
|
11
11
|
The Selling Partner API for Replenishment (Replenishment API) provides programmatic access to replenishment program metrics and offers. These programs provide recurring delivery of any replenishable item at a frequency chosen by the customer.
|
|
12
12
|
|
|
13
13
|
The Replenishment API is available worldwide wherever Amazon Subscribe & Save is available or is supported. The API is available to vendors and FBA selling partners.
|
|
14
14
|
"""
|
|
15
15
|
|
|
16
|
-
@sp_endpoint(
|
|
16
|
+
@sp_endpoint(
|
|
17
|
+
"/replenishment/2022-11-07/sellingPartners/metrics/search", method="POST"
|
|
18
|
+
)
|
|
17
19
|
def get_selling_partner_metrics(self, **kwargs) -> ApiResponse:
|
|
18
20
|
"""
|
|
19
21
|
get_selling_partner_metrics(self, **kwargs) -> ApiResponse
|
|
20
22
|
|
|
21
|
-
Returns aggregated replenishment program metrics for a selling partner.
|
|
23
|
+
Returns aggregated replenishment program metrics for a selling partner.
|
|
22
24
|
|
|
23
25
|
**Usage Plan:**
|
|
24
26
|
|
|
@@ -29,7 +31,7 @@ class Replenishment(Client):
|
|
|
29
31
|
The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
|
|
30
32
|
|
|
31
33
|
Args:
|
|
32
|
-
|
|
34
|
+
|
|
33
35
|
body: | {'description': 'The request body for the `getSellingPartnerMetrics` operation.',
|
|
34
36
|
'properties': {'aggregationFrequency': {'$ref': '#/definitions/AggregationFrequency'},
|
|
35
37
|
'marketplaceId': {'$ref': '#/definitions/MarketplaceId',
|
|
@@ -51,9 +53,9 @@ class Replenishment(Client):
|
|
|
51
53
|
ApiResponse:
|
|
52
54
|
"""
|
|
53
55
|
|
|
54
|
-
return self._request(kwargs.pop(
|
|
56
|
+
return self._request(kwargs.pop("path"), data=kwargs)
|
|
55
57
|
|
|
56
|
-
@sp_endpoint(
|
|
58
|
+
@sp_endpoint("/replenishment/2022-11-07/offers/metrics/search", method="POST")
|
|
57
59
|
def list_offer_metrics(self, **kwargs) -> ApiResponse:
|
|
58
60
|
"""
|
|
59
61
|
list_offer_metrics(self, **kwargs) -> ApiResponse
|
|
@@ -69,7 +71,7 @@ class Replenishment(Client):
|
|
|
69
71
|
The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
|
|
70
72
|
|
|
71
73
|
Args:
|
|
72
|
-
|
|
74
|
+
|
|
73
75
|
body: | {'description': 'The request body for the `listOfferMetrics` operation.',
|
|
74
76
|
'properties': {'filters': {'$ref': '#/definitions/ListOfferMetricsRequestFilters',
|
|
75
77
|
'description': 'Use these parameters to filter results. Any result must match all provided parameters. For any parameter that is an array, the result must match at least one element in the provided array.'},
|
|
@@ -83,9 +85,9 @@ class Replenishment(Client):
|
|
|
83
85
|
ApiResponse:
|
|
84
86
|
"""
|
|
85
87
|
|
|
86
|
-
return self._request(kwargs.pop(
|
|
88
|
+
return self._request(kwargs.pop("path"), data=kwargs)
|
|
87
89
|
|
|
88
|
-
@sp_endpoint(
|
|
90
|
+
@sp_endpoint("/replenishment/2022-11-07/offers/search", method="POST")
|
|
89
91
|
def list_offers(self, **kwargs) -> ApiResponse:
|
|
90
92
|
"""
|
|
91
93
|
list_offers(self, **kwargs) -> ApiResponse
|
|
@@ -101,7 +103,7 @@ class Replenishment(Client):
|
|
|
101
103
|
The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
|
|
102
104
|
|
|
103
105
|
Args:
|
|
104
|
-
|
|
106
|
+
|
|
105
107
|
body: | {'description': 'The request body for the `listOffers` operation.',
|
|
106
108
|
'properties': {'filters': {'$ref': '#/definitions/ListOffersRequestFilters',
|
|
107
109
|
'description': 'Use these parameters to filter results. Any result must match all provided parameters. For any parameter that is an array, the result must match at least one element in the provided array.'},
|
|
@@ -115,4 +117,4 @@ class Replenishment(Client):
|
|
|
115
117
|
ApiResponse:
|
|
116
118
|
"""
|
|
117
119
|
|
|
118
|
-
return self._request(kwargs.pop(
|
|
120
|
+
return self._request(kwargs.pop("path"), data=kwargs)
|