python-amazon-sp-api 1.9.60__py3-none-any.whl → 2.0.3__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.9.60.dist-info → python_amazon_sp_api-2.0.3.dist-info}/METADATA +41 -14
- python_amazon_sp_api-2.0.3.dist-info/RECORD +249 -0
- sp_api/__version__.py +1 -1
- sp_api/api/catalog/catalog.py +3 -4
- sp_api/api/catalog_items/catalog_items.py +3 -6
- sp_api/api/data_kiosk/data_kiosk.py +5 -6
- sp_api/api/feeds/feeds.py +11 -8
- sp_api/api/fulfillment_inbound/fulfillment_inbound.py +2 -2
- sp_api/api/inventories/inventories.py +2 -7
- sp_api/api/listings_items/listings_items.py +3 -24
- sp_api/api/products/products.py +3 -1
- sp_api/api/reports/reports.py +61 -97
- sp_api/api/sales/sales.py +2 -2
- sp_api/asyncio/__init__.py +0 -0
- sp_api/asyncio/api/__init__.py +164 -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/__init__.py +0 -0
- sp_api/asyncio/api/feeds/feeds.py +260 -0
- sp_api/asyncio/api/finances/__init__.py +0 -0
- sp_api/asyncio/api/finances/finances.py +100 -0
- sp_api/asyncio/api/fulfillment_inbound/__init__.py +0 -0
- sp_api/asyncio/api/fulfillment_inbound/fulfillment_inbound.py +1798 -0
- sp_api/asyncio/api/fulfillment_outbound/__init__.py +0 -0
- sp_api/asyncio/api/fulfillment_outbound/fulfillment_outbound.py +736 -0
- sp_api/asyncio/api/inventories/__init__.py +0 -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 +356 -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 +237 -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 +170 -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/_core.py +39 -0
- sp_api/auth/access_token_client.py +18 -30
- sp_api/base/_core.py +110 -0
- sp_api/base/_transport_httpx.py +39 -0
- sp_api/base/client.py +40 -63
- sp_api/util/__init__.py +16 -0
- sp_api/util/params.py +57 -0
- sp_api/util/report_document.py +154 -0
- python_amazon_sp_api-1.9.60.dist-info/RECORD +0 -133
- {python_amazon_sp_api-1.9.60.data → python_amazon_sp_api-2.0.3.data}/scripts/make_endpoint +0 -0
- {python_amazon_sp_api-1.9.60.dist-info → python_amazon_sp_api-2.0.3.dist-info}/WHEEL +0 -0
- {python_amazon_sp_api-1.9.60.dist-info → python_amazon_sp_api-2.0.3.dist-info}/licenses/LICENSE +0 -0
- {python_amazon_sp_api-1.9.60.dist-info → python_amazon_sp_api-2.0.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
from typing import Optional, List, Dict, Union
|
|
2
|
+
|
|
3
|
+
from sp_api.base import ApiResponse, Client, fill_query_params, sp_endpoint
|
|
4
|
+
from sp_api.asyncio.base import AsyncBaseClient
|
|
5
|
+
from sp_api.api.products.products_definitions import (
|
|
6
|
+
GetCompetitiveSummaryBatch,
|
|
7
|
+
GetFeaturedOfferExpectedPriceBatch,
|
|
8
|
+
GetItemOffersBatchRequest,
|
|
9
|
+
GetListingOffersBatchRequest,
|
|
10
|
+
)
|
|
11
|
+
from sp_api.util import ensure_csv
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Products(AsyncBaseClient):
|
|
15
|
+
"""
|
|
16
|
+
:links:
|
|
17
|
+
https://github.com/amzn/selling-partner-api-docs/blob/main/references/product-pricing-api/productPricingV0.md
|
|
18
|
+
https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v2022-05-01-reference
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
@sp_endpoint("/products/pricing/v0/price", method="GET")
|
|
22
|
+
async def get_product_pricing_for_skus(
|
|
23
|
+
self, seller_sku_list: [str], item_condition=None, offer_type=None, **kwargs
|
|
24
|
+
) -> ApiResponse:
|
|
25
|
+
"""
|
|
26
|
+
get_product_pricing_for_skus(self, seller_sku_list: [str], item_condition: str = None, **kwargs) -> ApiResponse
|
|
27
|
+
Returns pricing information for a seller's offer listings based on SKU.
|
|
28
|
+
|
|
29
|
+
**Usage Plan:**
|
|
30
|
+
|
|
31
|
+
====================================== ==============
|
|
32
|
+
Rate (requests per second) Burst
|
|
33
|
+
====================================== ==============
|
|
34
|
+
.5 1
|
|
35
|
+
====================================== ==============
|
|
36
|
+
|
|
37
|
+
Examples:
|
|
38
|
+
literal blocks::
|
|
39
|
+
|
|
40
|
+
Products().get_product_pricing_for_skus(['sku', 'sku1'], MarketplaceId="ATVPDKIKX0DER")
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
seller_sku_list: [str]
|
|
44
|
+
item_condition: str ("New", "Used", "Collectible", "Refurbished", "Club")
|
|
45
|
+
offer_type: str ("B2C" or "B2B") Default is B2C.
|
|
46
|
+
**kwargs:
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
ApiResponse:
|
|
50
|
+
"""
|
|
51
|
+
if item_condition is not None:
|
|
52
|
+
kwargs["ItemCondition"] = item_condition
|
|
53
|
+
if offer_type is not None:
|
|
54
|
+
kwargs["OfferType"] = offer_type
|
|
55
|
+
|
|
56
|
+
return self._create_get_pricing_request(seller_sku_list, "Sku", **kwargs)
|
|
57
|
+
|
|
58
|
+
@sp_endpoint("/products/pricing/v0/price", method="GET")
|
|
59
|
+
async def get_product_pricing_for_asins(
|
|
60
|
+
self, asin_list: [str], item_condition=None, offer_type=None, **kwargs
|
|
61
|
+
) -> ApiResponse:
|
|
62
|
+
"""
|
|
63
|
+
get_product_pricing_for_asins(self, asin_list: [str], item_condition=None, **kwargs) -> ApiResponse
|
|
64
|
+
Returns pricing information for a seller's offer listings based on ASIN.
|
|
65
|
+
|
|
66
|
+
**Usage Plan:**
|
|
67
|
+
|
|
68
|
+
====================================== ==============
|
|
69
|
+
Rate (requests per second) Burst
|
|
70
|
+
====================================== ==============
|
|
71
|
+
.5 1
|
|
72
|
+
====================================== ==============
|
|
73
|
+
|
|
74
|
+
Examples:
|
|
75
|
+
literal blocks::
|
|
76
|
+
|
|
77
|
+
Products().get_product_pricing_for_asins(['asin1', 'asin2'], MarketplaceId="ATVPDKIKX0DER")
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
asin_list: [str]
|
|
81
|
+
item_condition: str | ("New", "Used", "Collectible", "Refurbished", "Club") Filters the offer listings based on item condition. Possible values: New, Used, Collectible, Refurbished, Club. Available values : New, Used, Collectible, Refurbished, Club
|
|
82
|
+
offer_type: str ("B2C" or "B2B") Default is B2C.
|
|
83
|
+
Returns:
|
|
84
|
+
ApiResponse
|
|
85
|
+
"""
|
|
86
|
+
if item_condition is not None:
|
|
87
|
+
kwargs["ItemCondition"] = item_condition
|
|
88
|
+
if offer_type is not None:
|
|
89
|
+
kwargs["OfferType"] = offer_type
|
|
90
|
+
|
|
91
|
+
return self._create_get_pricing_request(asin_list, "Asin", **kwargs)
|
|
92
|
+
|
|
93
|
+
@sp_endpoint("/products/pricing/v0/competitivePrice", method="GET")
|
|
94
|
+
async def get_competitive_pricing_for_skus(
|
|
95
|
+
self, seller_sku_list: [str], customer_type=None, **kwargs
|
|
96
|
+
) -> ApiResponse:
|
|
97
|
+
"""
|
|
98
|
+
get_competitive_pricing_for_skus(self, seller_sku_list, **kwargs) -> ApiResponse
|
|
99
|
+
Returns competitive pricing information for a seller's offer listings based on Seller Sku
|
|
100
|
+
|
|
101
|
+
**Usage Plan:**
|
|
102
|
+
|
|
103
|
+
====================================== ==============
|
|
104
|
+
Rate (requests per second) Burst
|
|
105
|
+
====================================== ==============
|
|
106
|
+
.5 1
|
|
107
|
+
====================================== ==============
|
|
108
|
+
|
|
109
|
+
Examples:
|
|
110
|
+
literal blocks::
|
|
111
|
+
|
|
112
|
+
Products().get_competitive_pricing_for_skus([], MarketplaceId="ATVPDKIKX0DER")
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
seller_sku_list: [str]
|
|
116
|
+
customer_type: Optional (query) str ("Consumer" or "Business") Indicates whether to request pricing information from the point of view of Consumer or Business buyers. Default is Consumer.
|
|
117
|
+
|
|
118
|
+
Returns:
|
|
119
|
+
ApiResponse
|
|
120
|
+
"""
|
|
121
|
+
|
|
122
|
+
if customer_type is not None:
|
|
123
|
+
kwargs["CustomerType"] = customer_type
|
|
124
|
+
|
|
125
|
+
return self._create_get_pricing_request(seller_sku_list, "Sku", **kwargs)
|
|
126
|
+
|
|
127
|
+
@sp_endpoint("/products/pricing/v0/competitivePrice", method="GET")
|
|
128
|
+
async def get_competitive_pricing_for_asins(
|
|
129
|
+
self, asin_list: [str], customer_type=None, **kwargs
|
|
130
|
+
) -> ApiResponse:
|
|
131
|
+
"""
|
|
132
|
+
get_competitive_pricing_for_asins(self, asin_list, **kwargs) -> ApiResponse
|
|
133
|
+
Returns competitive pricing information for a seller's offer listings based on ASIN
|
|
134
|
+
|
|
135
|
+
**Usage Plan:**
|
|
136
|
+
|
|
137
|
+
====================================== ==============
|
|
138
|
+
Rate (requests per second) Burst
|
|
139
|
+
====================================== ==============
|
|
140
|
+
.5 1
|
|
141
|
+
====================================== ==============
|
|
142
|
+
|
|
143
|
+
Examples:
|
|
144
|
+
literal blocks::
|
|
145
|
+
|
|
146
|
+
Products().get_competitive_pricing_for_asins([], MarketplaceId="ATVPDKIKX0DER")
|
|
147
|
+
|
|
148
|
+
Args:
|
|
149
|
+
asin_list: [str]
|
|
150
|
+
customer_type: Optional (query) str ("Consumer" or "Business") Indicates whether to request pricing information from the point of view of Consumer or Business buyers. Default is Consumer.
|
|
151
|
+
|
|
152
|
+
Returns:
|
|
153
|
+
ApiResponse
|
|
154
|
+
|
|
155
|
+
"""
|
|
156
|
+
if customer_type is not None:
|
|
157
|
+
kwargs["CustomerType"] = customer_type
|
|
158
|
+
|
|
159
|
+
return self._create_get_pricing_request(asin_list, "Asin", **kwargs)
|
|
160
|
+
|
|
161
|
+
@sp_endpoint("/products/pricing/v0/listings/{}/offers", method="GET")
|
|
162
|
+
async def get_listings_offer(
|
|
163
|
+
self, seller_sku: str, item_condition: str, customer_type: str = None, **kwargs
|
|
164
|
+
) -> ApiResponse:
|
|
165
|
+
"""
|
|
166
|
+
get_listings_offer(self, seller_sku: str, **kwargs) -> ApiResponse
|
|
167
|
+
Returns the lowest priced offers for a single SKU listing
|
|
168
|
+
|
|
169
|
+
**Usage Plan:**
|
|
170
|
+
|
|
171
|
+
====================================== ==============
|
|
172
|
+
Rate (requests per second) Burst
|
|
173
|
+
====================================== ==============
|
|
174
|
+
1 2
|
|
175
|
+
====================================== ==============
|
|
176
|
+
|
|
177
|
+
Args:
|
|
178
|
+
key MarketplaceId: Required (query) str
|
|
179
|
+
item_condition: Required (query) str | ("New", "Used", "Collectible", "Refurbished", "Club") Filters the offer listings based on item condition. Possible values: New, Used, Collectible, Refurbished, Club. Available values : New, Used, Collectible, Refurbished, Club
|
|
180
|
+
seller_sku: Required (path) str
|
|
181
|
+
customer_type: Optional (query) str ("Consumer" or "Business") Indicates whether to request pricing information from the point of view of Consumer or Business buyers. Default is Consumer.
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
Returns:
|
|
185
|
+
ApiResponse
|
|
186
|
+
|
|
187
|
+
"""
|
|
188
|
+
kwargs["ItemCondition"] = item_condition
|
|
189
|
+
|
|
190
|
+
if customer_type is not None:
|
|
191
|
+
kwargs["CustomerType"] = customer_type
|
|
192
|
+
|
|
193
|
+
return await self._request(
|
|
194
|
+
fill_query_params(kwargs.pop("path"), seller_sku), params={**kwargs}
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
@sp_endpoint("/products/pricing/v0/items/{}/offers", method="GET")
|
|
198
|
+
async def get_item_offers(
|
|
199
|
+
self, asin: str, item_condition: str, customer_type: str = None, **kwargs
|
|
200
|
+
) -> ApiResponse:
|
|
201
|
+
"""
|
|
202
|
+
get_item_offers(self, asin: str, **kwargs) -> ApiResponse
|
|
203
|
+
Returns the lowest priced offers for a single item based on ASIN
|
|
204
|
+
|
|
205
|
+
**Usage Plan:**
|
|
206
|
+
|
|
207
|
+
====================================== ==============
|
|
208
|
+
Rate (requests per second) Burst
|
|
209
|
+
====================================== ==============
|
|
210
|
+
.5 1
|
|
211
|
+
====================================== ==============
|
|
212
|
+
|
|
213
|
+
Args:
|
|
214
|
+
key MarketplaceId: Required (query) str
|
|
215
|
+
item_condition: Required (query) str | ("New", "Used", "Collectible", "Refurbished", "Club") Filters the offer listings based on item condition. Possible values: New, Used, Collectible, Refurbished, Club. Available values : New, Used, Collectible, Refurbished, Club
|
|
216
|
+
asin: Required (path) str
|
|
217
|
+
customer_type: Optional (query) str ("Consumer" or "Business") Indicates whether to request pricing information from the point of view of Consumer or Business buyers. Default is Consumer.
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
Returns:
|
|
221
|
+
ApiResponse
|
|
222
|
+
|
|
223
|
+
"""
|
|
224
|
+
kwargs["ItemCondition"] = item_condition
|
|
225
|
+
|
|
226
|
+
if customer_type is not None:
|
|
227
|
+
kwargs["CustomerType"] = customer_type
|
|
228
|
+
|
|
229
|
+
return await self._request(
|
|
230
|
+
fill_query_params(kwargs.pop("path"), asin), params={**kwargs}
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
@sp_endpoint("/batches/products/pricing/v0/itemOffers", method="POST")
|
|
234
|
+
async def get_item_offers_batch(
|
|
235
|
+
self,
|
|
236
|
+
requests_: Optional[Union[List[Dict], GetItemOffersBatchRequest]] = None,
|
|
237
|
+
**kwargs,
|
|
238
|
+
) -> ApiResponse:
|
|
239
|
+
"""
|
|
240
|
+
get_item_offers_batch(self, requests_: Optional[List[Union[Dict, ItemOffersRequest]]], **kwargs) -> ApiResponse
|
|
241
|
+
Returns the lowest priced offers for a batch of items based on ASIN.
|
|
242
|
+
|
|
243
|
+
**Usage Plan:**
|
|
244
|
+
|
|
245
|
+
====================================== ==============
|
|
246
|
+
Rate (requests per second) Burst
|
|
247
|
+
====================================== ==============
|
|
248
|
+
.5 1
|
|
249
|
+
====================================== ==============
|
|
250
|
+
|
|
251
|
+
Args:
|
|
252
|
+
requests_: Optional (Body) [dict] The request associated with the getItemOffersBatch API call.
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
Returns:
|
|
256
|
+
ApiResponse
|
|
257
|
+
|
|
258
|
+
"""
|
|
259
|
+
if isinstance(requests_, GetItemOffersBatchRequest):
|
|
260
|
+
get_item_offers_batch_request = requests_.to_dict()
|
|
261
|
+
else:
|
|
262
|
+
get_item_offers_batch_request = {"requests": requests_}
|
|
263
|
+
|
|
264
|
+
return await self._request(
|
|
265
|
+
kwargs.pop("path"),
|
|
266
|
+
data=get_item_offers_batch_request,
|
|
267
|
+
params={**kwargs},
|
|
268
|
+
add_marketplace=False,
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
@sp_endpoint("/batches/products/pricing/v0/listingOffers", method="POST")
|
|
272
|
+
async def get_listing_offers_batch(
|
|
273
|
+
self,
|
|
274
|
+
requests_: Optional[Union[List[Dict], GetListingOffersBatchRequest]] = None,
|
|
275
|
+
**kwargs,
|
|
276
|
+
) -> ApiResponse:
|
|
277
|
+
"""
|
|
278
|
+
get_listing_offers_batch(self, requests_: Optional[Union[List[Dict], GetListingOffersBatchRequest]], **kwargs) -> ApiResponse
|
|
279
|
+
Returns the lowest priced offers for a batch of listings based on ASIN.
|
|
280
|
+
|
|
281
|
+
**Usage Plan:**
|
|
282
|
+
|
|
283
|
+
====================================== ==============
|
|
284
|
+
Rate (requests per second) Burst
|
|
285
|
+
====================================== ==============
|
|
286
|
+
.5 1
|
|
287
|
+
====================================== ==============
|
|
288
|
+
|
|
289
|
+
Args:
|
|
290
|
+
requests_: Optional (Body) [dict] The request associated with the getListingOffersBatch API call.
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
Returns:
|
|
294
|
+
ApiResponse
|
|
295
|
+
|
|
296
|
+
"""
|
|
297
|
+
if isinstance(requests_, GetListingOffersBatchRequest):
|
|
298
|
+
get_listing_offers_batch_request = requests_.to_dict()
|
|
299
|
+
else:
|
|
300
|
+
get_listing_offers_batch_request = {"requests": requests_}
|
|
301
|
+
|
|
302
|
+
return await self._request(
|
|
303
|
+
kwargs.pop("path"),
|
|
304
|
+
data=get_listing_offers_batch_request,
|
|
305
|
+
params={**kwargs},
|
|
306
|
+
add_marketplace=False,
|
|
307
|
+
)
|
|
308
|
+
|
|
309
|
+
@sp_endpoint('/batches/products/pricing/2022-05-01/offer/featuredOfferExpectedPrice', method='POST')
|
|
310
|
+
async def get_featured_offer_expected_price_batch(self, requests_: Optional[
|
|
311
|
+
Union[List[Dict], GetFeaturedOfferExpectedPriceBatch]], **kwargs) -> ApiResponse:
|
|
312
|
+
"""
|
|
313
|
+
get_featured_offer_expected_price_batch(self, **kwargs) -> ApiResponse
|
|
314
|
+
|
|
315
|
+
Returns the set of responses that correspond to the batched list of up to 40 requests defined in the request
|
|
316
|
+
body. The response for each successful (HTTP status code 200) request in the set includes the computed listing
|
|
317
|
+
price at or below which a seller can expect to become the featured offer (before applicable promotions).
|
|
318
|
+
This is called the featured offer expected price (FOEP). Featured offer is not guaranteed, because competing
|
|
319
|
+
offers may change, and different offers may be featured based on other factors, including fulfillment
|
|
320
|
+
capabilities to a specific customer. The response to an unsuccessful request includes the available error text.
|
|
321
|
+
|
|
322
|
+
**Usage Plan:**
|
|
323
|
+
|
|
324
|
+
====================================== ==============
|
|
325
|
+
Rate (requests per second) Burst
|
|
326
|
+
====================================== ==============
|
|
327
|
+
.033 1
|
|
328
|
+
====================================== ==============
|
|
329
|
+
|
|
330
|
+
Args:
|
|
331
|
+
requests_: [dict] The request associated with the getFeaturedOfferExpectedPriceBatch API call.
|
|
332
|
+
|
|
333
|
+
Returns:
|
|
334
|
+
ApiResponse:
|
|
335
|
+
"""
|
|
336
|
+
if isinstance(requests_, GetFeaturedOfferExpectedPriceBatch):
|
|
337
|
+
get_featured_offer_expected_price_batch_request = requests_.to_dict()
|
|
338
|
+
else:
|
|
339
|
+
get_featured_offer_expected_price_batch_request = {"requests": requests_}
|
|
340
|
+
|
|
341
|
+
return await self._request(
|
|
342
|
+
kwargs.pop('path'),
|
|
343
|
+
data=get_featured_offer_expected_price_batch_request,
|
|
344
|
+
params={**kwargs},
|
|
345
|
+
add_marketplace=False
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
@sp_endpoint('/batches/products/pricing/2022-05-01/items/competitiveSummary', method='POST')
|
|
349
|
+
async def get_competitive_summary_batch(self, requests_: Optional[Union[List[Dict], GetCompetitiveSummaryBatch]], **kwargs) -> ApiResponse:
|
|
350
|
+
"""
|
|
351
|
+
get_competitive_summary(self, **kwargs) -> ApiResponse
|
|
352
|
+
|
|
353
|
+
Returns the competitive summary response including featured buying options for the ASIN and `marketplaceId` combination.
|
|
354
|
+
|
|
355
|
+
**Usage Plan:**
|
|
356
|
+
|
|
357
|
+
====================================== ==============
|
|
358
|
+
Rate (requests per second) Burst
|
|
359
|
+
====================================== ==============
|
|
360
|
+
.033 1
|
|
361
|
+
====================================== ==============
|
|
362
|
+
|
|
363
|
+
Args:
|
|
364
|
+
requests_: The request associated with the getCompetitiveSummary API call.
|
|
365
|
+
|
|
366
|
+
Returns:
|
|
367
|
+
ApiResponse:
|
|
368
|
+
"""
|
|
369
|
+
if isinstance(requests_, GetCompetitiveSummaryBatch):
|
|
370
|
+
get_competitive_summary_batch_request = requests_.to_dict()
|
|
371
|
+
else:
|
|
372
|
+
get_competitive_summary_batch_request = {"requests": requests_}
|
|
373
|
+
|
|
374
|
+
return await self._request(
|
|
375
|
+
kwargs.pop('path'),
|
|
376
|
+
data=get_competitive_summary_batch_request,
|
|
377
|
+
params={**kwargs},
|
|
378
|
+
add_marketplace=False
|
|
379
|
+
)
|
|
380
|
+
|
|
381
|
+
async def _create_get_pricing_request(self, item_list, item_type, **kwargs):
|
|
382
|
+
items_csv = ensure_csv(item_list)
|
|
383
|
+
return await self._request(
|
|
384
|
+
kwargs.pop("path"),
|
|
385
|
+
params={
|
|
386
|
+
**{f"{item_type}s": items_csv},
|
|
387
|
+
"ItemType": item_type,
|
|
388
|
+
**(
|
|
389
|
+
{"ItemCondition": kwargs.pop("ItemCondition")}
|
|
390
|
+
if "ItemCondition" in kwargs
|
|
391
|
+
else {}
|
|
392
|
+
),
|
|
393
|
+
**(
|
|
394
|
+
{"CustomerType": kwargs.pop("CustomerType")}
|
|
395
|
+
if "CustomerType" in kwargs
|
|
396
|
+
else {}
|
|
397
|
+
),
|
|
398
|
+
**(
|
|
399
|
+
{"OfferType": kwargs.pop("OfferType")}
|
|
400
|
+
if "OfferType" in kwargs
|
|
401
|
+
else {}
|
|
402
|
+
),
|
|
403
|
+
"MarketplaceId": kwargs.get("MarketplaceId", self.marketplace_id),
|
|
404
|
+
},
|
|
405
|
+
)
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
from sp_api.asyncio.base import AsyncBaseClient
|
|
2
|
+
from enum import Enum
|
|
3
|
+
from typing import Optional, List, Dict, Union
|
|
4
|
+
from dataclasses import dataclass, asdict
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class CompetitiveSummaryIncludedData(Enum):
|
|
8
|
+
FEATURED_BUYING_OPTIONS = "featuredBuyingOptions"
|
|
9
|
+
LOWEST_PRICED_OFFERS = "lowestPricedOffers"
|
|
10
|
+
REFERENCE_PRICES = "referencePrices"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dataclass
|
|
14
|
+
class ItemOffersRequest:
|
|
15
|
+
"""Implements definition: https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v0-reference
|
|
16
|
+
#itemoffersrequest"""
|
|
17
|
+
|
|
18
|
+
uri: str
|
|
19
|
+
method: str
|
|
20
|
+
MarketplaceId: str
|
|
21
|
+
ItemCondition: str = None
|
|
22
|
+
CustomerType: str = None
|
|
23
|
+
headers: Dict = None
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@dataclass
|
|
27
|
+
class GetItemOffersBatchRequest:
|
|
28
|
+
"""Implements definition: https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v0-reference
|
|
29
|
+
#getitemoffersbatchrequest"""
|
|
30
|
+
|
|
31
|
+
requests: Optional[List[Union[ItemOffersRequest, Dict]]] = None
|
|
32
|
+
|
|
33
|
+
def __post_init__(self):
|
|
34
|
+
self.requests = self.parse_requests(self.requests)
|
|
35
|
+
|
|
36
|
+
def to_dict(self):
|
|
37
|
+
return asdict(self)
|
|
38
|
+
|
|
39
|
+
@staticmethod
|
|
40
|
+
def parse_requests(requests) -> List[ItemOffersRequest]:
|
|
41
|
+
parsed_requestes = []
|
|
42
|
+
|
|
43
|
+
for request in requests:
|
|
44
|
+
if isinstance(request, Dict):
|
|
45
|
+
request = ItemOffersRequest(**request)
|
|
46
|
+
|
|
47
|
+
if not isinstance(request, ItemOffersRequest):
|
|
48
|
+
raise TypeError
|
|
49
|
+
|
|
50
|
+
parsed_requestes.append(request)
|
|
51
|
+
|
|
52
|
+
return parsed_requestes
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass
|
|
56
|
+
class ListingOffersRequest:
|
|
57
|
+
"""Implements definition: https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v0-reference
|
|
58
|
+
#listingoffersrequest"""
|
|
59
|
+
|
|
60
|
+
uri: str
|
|
61
|
+
MarketplaceId: str
|
|
62
|
+
ItemCondition: str
|
|
63
|
+
method: str = "GET"
|
|
64
|
+
CustomerType: str = "Consumer"
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@dataclass
|
|
68
|
+
class GetListingOffersBatchRequest:
|
|
69
|
+
"""Implements definition: https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v0-reference
|
|
70
|
+
#getlistingoffersbatchrequest"""
|
|
71
|
+
|
|
72
|
+
requests: Optional[List[Union[ListingOffersRequest, Dict]]] = None
|
|
73
|
+
|
|
74
|
+
def __post_init__(self):
|
|
75
|
+
self.requests = self.parse_requests(self.requests)
|
|
76
|
+
|
|
77
|
+
def to_dict(self):
|
|
78
|
+
return asdict(self)
|
|
79
|
+
|
|
80
|
+
@staticmethod
|
|
81
|
+
def parse_requests(requests) -> List[ListingOffersRequest]:
|
|
82
|
+
parsed_requestes = []
|
|
83
|
+
|
|
84
|
+
for request in requests:
|
|
85
|
+
if isinstance(request, Dict):
|
|
86
|
+
request = ListingOffersRequest(**request)
|
|
87
|
+
|
|
88
|
+
if not isinstance(request, ListingOffersRequest):
|
|
89
|
+
raise TypeError
|
|
90
|
+
|
|
91
|
+
parsed_requestes.append(request)
|
|
92
|
+
|
|
93
|
+
return parsed_requestes
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
@dataclass
|
|
97
|
+
class FeaturedOfferExpectedPriceRequest:
|
|
98
|
+
""" Implements definition: https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v2022-05-01-reference
|
|
99
|
+
#FeaturedOfferExpectedPriceRequest """
|
|
100
|
+
marketplaceId: str
|
|
101
|
+
sku: str
|
|
102
|
+
uri: str = "/products/pricing/2022-05-01/offer/featuredOfferExpectedPrice"
|
|
103
|
+
method: str = "GET"
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
@dataclass
|
|
107
|
+
class GetFeaturedOfferExpectedPriceBatch:
|
|
108
|
+
""" Implements definition: https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v2022-05-01-reference
|
|
109
|
+
#getFeaturedOfferExpectedPriceBatch """
|
|
110
|
+
requests: Optional[List[Union[FeaturedOfferExpectedPriceRequest, Dict]]] = None
|
|
111
|
+
|
|
112
|
+
def __post_init__(self):
|
|
113
|
+
self.requests = self.parse_requests(self.requests)
|
|
114
|
+
|
|
115
|
+
def to_dict(self):
|
|
116
|
+
return asdict(self)
|
|
117
|
+
|
|
118
|
+
@staticmethod
|
|
119
|
+
def parse_requests(requests) -> List[FeaturedOfferExpectedPriceRequest]:
|
|
120
|
+
parsed_requests = []
|
|
121
|
+
|
|
122
|
+
for request in requests:
|
|
123
|
+
if isinstance(request, Dict):
|
|
124
|
+
request = FeaturedOfferExpectedPriceRequest(**request)
|
|
125
|
+
|
|
126
|
+
if not isinstance(request, FeaturedOfferExpectedPriceRequest):
|
|
127
|
+
raise TypeError
|
|
128
|
+
|
|
129
|
+
parsed_requests.append(request)
|
|
130
|
+
|
|
131
|
+
return parsed_requests
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
@dataclass
|
|
135
|
+
class CompetitiveSummaryRequest:
|
|
136
|
+
""" Implements definition: https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v2022-05-01-reference
|
|
137
|
+
#FeaturedOfferExpectedPriceRequest """
|
|
138
|
+
marketplaceId: str
|
|
139
|
+
asin: str
|
|
140
|
+
includedData: List[CompetitiveSummaryIncludedData]
|
|
141
|
+
uri: str = "/products/pricing/2022-05-01/items/competitiveSummary"
|
|
142
|
+
method: str = "GET"
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
@dataclass
|
|
146
|
+
class GetCompetitiveSummaryBatch:
|
|
147
|
+
""" Implements definition: https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v2022-05-01-reference
|
|
148
|
+
#getCompetitiveSummary """
|
|
149
|
+
requests: Optional[List[Union[CompetitiveSummaryRequest, Dict]]] = None
|
|
150
|
+
|
|
151
|
+
def __post_init__(self):
|
|
152
|
+
self.requests = self.parse_requests(self.requests)
|
|
153
|
+
|
|
154
|
+
def to_dict(self):
|
|
155
|
+
return asdict(self)
|
|
156
|
+
|
|
157
|
+
@staticmethod
|
|
158
|
+
def parse_requests(requests) -> List[CompetitiveSummaryRequest]:
|
|
159
|
+
parsed_requests = []
|
|
160
|
+
|
|
161
|
+
for request in requests:
|
|
162
|
+
if isinstance(request, Dict):
|
|
163
|
+
request = CompetitiveSummaryRequest(**request)
|
|
164
|
+
|
|
165
|
+
if not isinstance(request, CompetitiveSummaryRequest):
|
|
166
|
+
raise TypeError
|
|
167
|
+
|
|
168
|
+
parsed_requests.append(request)
|
|
169
|
+
|
|
170
|
+
return parsed_requests
|
|
File without changes
|