python-amazon-sp-api 1.9.18__py3-none-any.whl → 2.0.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. {python_amazon_sp_api-1.9.18.data → python_amazon_sp_api-2.0.7.data}/scripts/make_endpoint +2 -2
  2. {python_amazon_sp_api-1.9.18.dist-info → python_amazon_sp_api-2.0.7.dist-info}/METADATA +46 -23
  3. python_amazon_sp_api-2.0.7.dist-info/RECORD +251 -0
  4. {python_amazon_sp_api-1.9.18.dist-info → python_amazon_sp_api-2.0.7.dist-info}/WHEEL +1 -1
  5. {python_amazon_sp_api-1.9.18.dist-info → python_amazon_sp_api-2.0.7.dist-info}/top_level.txt +0 -1
  6. sp_api/__version__.py +1 -1
  7. sp_api/api/__init__.py +18 -1
  8. sp_api/api/application_integrations/application_integrations.py +118 -0
  9. sp_api/api/application_management/application_management.py +2 -1
  10. sp_api/api/catalog/catalog.py +3 -4
  11. sp_api/api/catalog_items/catalog_items.py +3 -6
  12. sp_api/api/customer_feedback/customer_feedback.py +110 -0
  13. sp_api/api/data_kiosk/data_kiosk.py +5 -6
  14. sp_api/api/easy_ship/easy_ship.py +190 -0
  15. sp_api/api/external_fulfillment/external_fulfillment.py +706 -0
  16. sp_api/api/feeds/feeds.py +11 -8
  17. sp_api/api/finances/finances.py +30 -4
  18. sp_api/api/fulfillment_inbound/fulfillment_inbound.py +35 -2
  19. sp_api/api/inventories/inventories.py +2 -7
  20. sp_api/api/listings_items/listings_items.py +3 -24
  21. sp_api/api/messaging/messaging.py +42 -0
  22. sp_api/api/orders/orders.py +7 -0
  23. sp_api/api/product_fees/product_fees.py +31 -74
  24. sp_api/api/products/products.py +80 -2
  25. sp_api/api/products/products_definitions.py +11 -85
  26. sp_api/api/reports/reports.py +65 -97
  27. sp_api/api/sales/sales.py +2 -2
  28. sp_api/asyncio/api/__init__.py +164 -0
  29. sp_api/asyncio/api/amazon_warehousing_and_distribu/__init__.py +9 -0
  30. sp_api/asyncio/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +130 -0
  31. sp_api/asyncio/api/aplus_content/__init__.py +5 -0
  32. sp_api/asyncio/api/aplus_content/aplus_content.py +330 -0
  33. sp_api/asyncio/api/application_integrations/__init__.py +5 -0
  34. sp_api/asyncio/api/application_integrations/application_integrations.py +119 -0
  35. sp_api/asyncio/api/application_management/__init__.py +5 -0
  36. sp_api/asyncio/api/application_management/application_management.py +36 -0
  37. sp_api/asyncio/api/authorization/__init__.py +5 -0
  38. sp_api/asyncio/api/authorization/authorization.py +54 -0
  39. sp_api/asyncio/api/catalog/__init__.py +5 -0
  40. sp_api/asyncio/api/catalog/catalog.py +111 -0
  41. sp_api/asyncio/api/catalog_items/__init__.py +6 -0
  42. sp_api/asyncio/api/catalog_items/catalog_items.py +93 -0
  43. sp_api/asyncio/api/clients/__init__.py +1 -0
  44. sp_api/asyncio/api/customer_feedback/__init__.py +5 -0
  45. sp_api/asyncio/api/customer_feedback/customer_feedback.py +111 -0
  46. sp_api/asyncio/api/data_kiosk/__init__.py +5 -0
  47. sp_api/asyncio/api/data_kiosk/data_kiosk.py +236 -0
  48. sp_api/asyncio/api/easy_ship/__init__.py +5 -0
  49. sp_api/asyncio/api/easy_ship/easy_ship.py +191 -0
  50. sp_api/asyncio/api/external_fulfillment/__init__.py +5 -0
  51. sp_api/asyncio/api/external_fulfillment/external_fulfillment.py +706 -0
  52. sp_api/asyncio/api/fba_inbound_eligibility/__init__.py +5 -0
  53. sp_api/asyncio/api/fba_inbound_eligibility/fba_inbound_eligibility.py +96 -0
  54. sp_api/asyncio/api/fba_small_and_light/__init__.py +5 -0
  55. sp_api/asyncio/api/fba_small_and_light/fba_small_and_light.py +213 -0
  56. sp_api/asyncio/api/feeds/feeds.py +260 -0
  57. sp_api/asyncio/api/finances/finances.py +100 -0
  58. sp_api/asyncio/api/fulfillment_inbound/fulfillment_inbound.py +1798 -0
  59. sp_api/asyncio/api/fulfillment_outbound/fulfillment_outbound.py +736 -0
  60. sp_api/asyncio/api/inventories/inventories.py +74 -0
  61. sp_api/asyncio/api/listings_items/__init__.py +0 -0
  62. sp_api/asyncio/api/listings_items/listings_items.py +170 -0
  63. sp_api/asyncio/api/listings_restrictions/__init__.py +0 -0
  64. sp_api/asyncio/api/listings_restrictions/listings_restrictions.py +36 -0
  65. sp_api/asyncio/api/merchant_fulfillment/__init__.py +0 -0
  66. sp_api/asyncio/api/merchant_fulfillment/merchant_fulfillment.py +384 -0
  67. sp_api/asyncio/api/messaging/__init__.py +0 -0
  68. sp_api/asyncio/api/messaging/messaging.py +511 -0
  69. sp_api/asyncio/api/models/__init__.py +4 -0
  70. sp_api/asyncio/api/notifications/__init__.py +0 -0
  71. sp_api/asyncio/api/notifications/notifications.py +295 -0
  72. sp_api/asyncio/api/orders/__init__.py +0 -0
  73. sp_api/asyncio/api/orders/orders.py +362 -0
  74. sp_api/asyncio/api/overrides/__init__.py +1 -0
  75. sp_api/asyncio/api/product_fees/__init__.py +0 -0
  76. sp_api/asyncio/api/product_fees/product_fees.py +194 -0
  77. sp_api/asyncio/api/product_type_definitions/__init__.py +0 -0
  78. sp_api/asyncio/api/product_type_definitions/product_type_definitions.py +75 -0
  79. sp_api/asyncio/api/products/__init__.py +0 -0
  80. sp_api/asyncio/api/products/products.py +405 -0
  81. sp_api/asyncio/api/products/products_definitions.py +11 -0
  82. sp_api/asyncio/api/replenishment/__init__.py +0 -0
  83. sp_api/asyncio/api/replenishment/replenishment.py +121 -0
  84. sp_api/asyncio/api/reports/__init__.py +0 -0
  85. sp_api/asyncio/api/reports/reports.py +439 -0
  86. sp_api/asyncio/api/sales/__init__.py +0 -0
  87. sp_api/asyncio/api/sales/sales.py +93 -0
  88. sp_api/asyncio/api/sellers/__init__.py +0 -0
  89. sp_api/asyncio/api/sellers/sellers.py +70 -0
  90. sp_api/asyncio/api/services/__init__.py +0 -0
  91. sp_api/asyncio/api/services/services.py +218 -0
  92. sp_api/asyncio/api/shipping/__init__.py +0 -0
  93. sp_api/asyncio/api/shipping/shipping.py +459 -0
  94. sp_api/asyncio/api/shipping/shippingV2.py +651 -0
  95. sp_api/asyncio/api/solicitations/__init__.py +0 -0
  96. sp_api/asyncio/api/solicitations/solicitations.py +78 -0
  97. sp_api/asyncio/api/supply_sources/__init__.py +0 -0
  98. sp_api/asyncio/api/supply_sources/supply_sources.py +138 -0
  99. sp_api/asyncio/api/tokens/__init__.py +0 -0
  100. sp_api/asyncio/api/tokens/tokens.py +65 -0
  101. sp_api/asyncio/api/upload/__init__.py +0 -0
  102. sp_api/asyncio/api/upload/upload.py +18 -0
  103. sp_api/asyncio/api/vendor_direct_fulfillment_inventory/__init__.py +0 -0
  104. sp_api/asyncio/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +64 -0
  105. sp_api/asyncio/api/vendor_direct_fulfillment_orders/__init__.py +0 -0
  106. sp_api/asyncio/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +196 -0
  107. sp_api/asyncio/api/vendor_direct_fulfillment_payments/__init__.py +0 -0
  108. sp_api/asyncio/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +254 -0
  109. sp_api/asyncio/api/vendor_direct_fulfillment_shipping/__init__.py +0 -0
  110. sp_api/asyncio/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +627 -0
  111. sp_api/asyncio/api/vendor_direct_fulfillment_transactions/__init__.py +0 -0
  112. sp_api/asyncio/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +43 -0
  113. sp_api/asyncio/api/vendor_invoices/__init__.py +0 -0
  114. sp_api/asyncio/api/vendor_invoices/vendor_invoices.py +295 -0
  115. sp_api/asyncio/api/vendor_orders/__init__.py +0 -0
  116. sp_api/asyncio/api/vendor_orders/vendor_orders.py +210 -0
  117. sp_api/asyncio/api/vendor_shipments/__init__.py +0 -0
  118. sp_api/asyncio/api/vendor_shipments/vendor_shipments.py +118 -0
  119. sp_api/asyncio/api/vendor_transaction_status/__init__.py +0 -0
  120. sp_api/asyncio/api/vendor_transaction_status/vendor_transaction_status.py +41 -0
  121. sp_api/asyncio/auth/__init__.py +12 -0
  122. sp_api/asyncio/auth/access_token_client.py +145 -0
  123. sp_api/asyncio/auth/exceptions.py +5 -0
  124. sp_api/asyncio/base/__init__.py +53 -0
  125. sp_api/asyncio/base/_transport_httpx.py +50 -0
  126. sp_api/asyncio/base/base_client.py +8 -0
  127. sp_api/asyncio/base/client.py +169 -0
  128. sp_api/asyncio/util/__init__.py +29 -0
  129. sp_api/asyncio/util/key_maker.py +5 -0
  130. sp_api/asyncio/util/load_all_pages.py +55 -0
  131. sp_api/asyncio/util/load_date_bound.py +53 -0
  132. sp_api/asyncio/util/retry.py +88 -0
  133. sp_api/auth/_core.py +39 -0
  134. sp_api/auth/access_token_client.py +18 -29
  135. sp_api/base/ApiResponse.py +3 -2
  136. sp_api/base/_core.py +110 -0
  137. sp_api/base/_transport_httpx.py +39 -0
  138. sp_api/base/client.py +40 -63
  139. sp_api/base/helpers.py +1 -1
  140. sp_api/base/reportTypes.py +3 -2
  141. sp_api/util/__init__.py +36 -0
  142. sp_api/util/load_all_pages.py +2 -1
  143. sp_api/util/params.py +57 -0
  144. sp_api/util/product_fees.py +40 -0
  145. sp_api/util/products_definitions.py +169 -0
  146. sp_api/util/report_document.py +154 -0
  147. python_amazon_sp_api-1.9.18.dist-info/RECORD +0 -144
  148. tests/api/finances/test_finances.py +0 -19
  149. tests/api/notifications/test_notifications.py +0 -26
  150. tests/api/orders/test_orders.py +0 -122
  151. tests/api/product_fees/product_fees.py +0 -49
  152. tests/api/reports/test_reports.py +0 -127
  153. tests/client/test_auth.py +0 -59
  154. tests/client/test_base.py +0 -163
  155. tests/client/test_credential_provider.py +0 -45
  156. tests/client/test_helpers.py +0 -142
  157. {python_amazon_sp_api-1.9.18.dist-info → python_amazon_sp_api-2.0.7.dist-info/licenses}/LICENSE +0 -0
  158. {tests → sp_api/api/application_integrations}/__init__.py +0 -0
  159. {tests/api → sp_api/api/customer_feedback}/__init__.py +0 -0
  160. {tests/api/finances → sp_api/api/easy_ship}/__init__.py +0 -0
  161. {tests/api/notifications → sp_api/api/external_fulfillment}/__init__.py +0 -0
  162. {tests/api/orders → sp_api/asyncio}/__init__.py +0 -0
  163. {tests/api/product_fees → sp_api/asyncio/api/feeds}/__init__.py +0 -0
  164. {tests/api/reports → sp_api/asyncio/api/finances}/__init__.py +0 -0
  165. {tests/api/sellers → sp_api/asyncio/api/fulfillment_inbound}/__init__.py +0 -0
  166. {tests/client → sp_api/asyncio/api/fulfillment_outbound}/__init__.py +0 -0
  167. /tests/api/sellers/test_sellers.py → /sp_api/asyncio/api/inventories/__init__.py +0 -0
@@ -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
@@ -0,0 +1,75 @@
1
+ import urllib.parse
2
+
3
+ from sp_api.base import Client, sp_endpoint, fill_query_params, ApiResponse
4
+ from sp_api.asyncio.base import AsyncBaseClient
5
+
6
+
7
+ class ProductTypeDefinitions(AsyncBaseClient):
8
+ """
9
+ ProductTypeDefinitions SP-API Client
10
+ :link:
11
+
12
+ The Selling Partner API for Product Type Definitions provides programmatic access to attribute and data requirements for product types in the Amazon catalog. Use this API to return the JSON Schema for a product type that you can then use with other Selling Partner APIs, such as the Selling Partner API for Listings Items, the Selling Partner API for Catalog Items, and the Selling Partner API for Feeds (for JSON-based listing feeds).
13
+ """
14
+
15
+ @sp_endpoint("/definitions/2020-09-01/productTypes", method="GET")
16
+ async def search_definitions_product_types(self, **kwargs) -> ApiResponse:
17
+ """
18
+ search_definitions_product_types(self, **kwargs) -> ApiResponse
19
+
20
+ Search for and return a list of Amazon product types that have definitions available.
21
+
22
+ **Usage Plans:**
23
+
24
+ ====================================== ==============
25
+ Rate (requests per second) Burst
26
+ ====================================== ==============
27
+ 5 10
28
+ ====================================== ==============
29
+
30
+ The x-amzn-RateLimit-Limit response header returns the usage plan rate limits that were applied to the requested operation. Rate limits for some selling partners will vary from the default rate and burst shown in the table above. For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
31
+
32
+ Args:
33
+ key keywords:array | A comma-delimited list of keywords to search product types by.
34
+ key marketplaceIds:array | * REQUIRED A comma-delimited list of Amazon marketplace identifiers for the request.
35
+
36
+ Returns:
37
+ ApiResponse:
38
+ """
39
+
40
+ return await self._request(kwargs.pop("path"), params=kwargs)
41
+
42
+ @sp_endpoint("/definitions/2020-09-01/productTypes/{}", method="GET")
43
+ async def get_definitions_product_type(self, productType, **kwargs) -> ApiResponse:
44
+ """
45
+ get_definitions_product_type(self, productType, **kwargs) -> ApiResponse
46
+
47
+ Retrieve an Amazon product type definition.
48
+
49
+ **Usage Plans:**
50
+
51
+
52
+ ====================================== ==============
53
+ Rate (requests per second) Burst
54
+ ====================================== ==============
55
+ 5 10
56
+ ====================================== ==============
57
+
58
+ The x-amzn-RateLimit-Limit response header returns the usage plan rate limits that were applied to the requested operation. Rate limits for some selling partners will vary from the default rate and burst shown in the table above. For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
59
+
60
+ Args:
61
+ productType:string | * REQUIRED The Amazon product type name.
62
+ key sellerId:string | A selling partner identifier. When provided, seller-specific requirements and values are populated within the product type definition schema, such as brand names associated with the selling partner.
63
+ key marketplaceIds:array | * REQUIRED A comma-delimited list of Amazon marketplace identifiers for the request.
64
+ key productTypeVersion:string | The version of the Amazon product type to retrieve. Defaults to "LATEST",. Prerelease versions of product type definitions may be retrieved with "RELEASE_CANDIDATE". If no prerelease version is currently available, the "LATEST" live version will be provided.
65
+ key requirements:string | The name of the requirements set to retrieve requirements for.
66
+ key requirementsEnforced:string | Identifies if the required attributes for a requirements set are enforced by the product type definition schema. Non-enforced requirements enable structural validation of individual attributes without all the required attributes being present (such as for partial updates).
67
+ key locale:string | Locale for retrieving display labels and other presentation details. Defaults to the default language of the first marketplace in the request.
68
+
69
+ Returns:
70
+ ApiResponse:
71
+ """
72
+
73
+ return await self._request(
74
+ fill_query_params(kwargs.pop("path"), productType), params=kwargs
75
+ )
File without changes
@@ -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
+ )