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.
Files changed (214) hide show
  1. {python_amazon_sp_api-1.7.5.data → python_amazon_sp_api-2.0.10.data}/scripts/make_endpoint +2 -2
  2. {python_amazon_sp_api-1.7.5.dist-info → python_amazon_sp_api-2.0.10.dist-info}/METADATA +58 -8
  3. python_amazon_sp_api-2.0.10.dist-info/RECORD +253 -0
  4. {python_amazon_sp_api-1.7.5.dist-info → python_amazon_sp_api-2.0.10.dist-info}/WHEEL +1 -1
  5. {python_amazon_sp_api-1.7.5.dist-info → python_amazon_sp_api-2.0.10.dist-info}/top_level.txt +0 -1
  6. sp_api/__version__.py +1 -1
  7. sp_api/api/__init__.py +48 -41
  8. sp_api/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +82 -76
  9. sp_api/api/aplus_content/aplus_content.py +76 -45
  10. sp_api/api/application_integrations/application_integrations.py +118 -0
  11. sp_api/api/application_management/application_management.py +6 -7
  12. sp_api/api/authorization/authorization.py +5 -5
  13. sp_api/api/catalog/catalog.py +9 -10
  14. sp_api/api/catalog_items/catalog_items.py +10 -13
  15. sp_api/api/customer_feedback/customer_feedback.py +110 -0
  16. sp_api/api/data_kiosk/data_kiosk.py +59 -39
  17. sp_api/api/easy_ship/easy_ship.py +190 -0
  18. sp_api/api/external_fulfillment/external_fulfillment.py +706 -0
  19. sp_api/api/fba_inbound_eligibility/fba_inbound_eligibility.py +23 -13
  20. sp_api/api/fba_small_and_light/fba_small_and_light.py +46 -20
  21. sp_api/api/feeds/feeds.py +60 -39
  22. sp_api/api/finances/finances.py +40 -9
  23. sp_api/api/fulfillment_inbound/fulfillment_inbound.py +844 -619
  24. sp_api/api/fulfillment_outbound/fulfillment_outbound.py +63 -57
  25. sp_api/api/inventories/inventories.py +13 -11
  26. sp_api/api/listings_items/listings_items.py +38 -25
  27. sp_api/api/listings_restrictions/listings_restrictions.py +6 -7
  28. sp_api/api/merchant_fulfillment/merchant_fulfillment.py +49 -36
  29. sp_api/api/messaging/messaging.py +129 -25
  30. sp_api/api/notifications/notifications.py +85 -45
  31. sp_api/api/orders/orders.py +123 -38
  32. sp_api/api/orders/orders_2026_01_01.py +54 -0
  33. sp_api/api/product_fees/product_fees.py +75 -67
  34. sp_api/api/product_type_definitions/product_type_definitions.py +9 -10
  35. sp_api/api/products/products.py +177 -53
  36. sp_api/api/products/products_definitions.py +11 -82
  37. sp_api/api/replenishment/replenishment.py +13 -11
  38. sp_api/api/reports/reports.py +113 -95
  39. sp_api/api/sales/sales.py +23 -13
  40. sp_api/api/sellers/sellers.py +3 -3
  41. sp_api/api/services/services.py +41 -30
  42. sp_api/api/shipping/shipping.py +39 -37
  43. sp_api/api/shipping/shippingV2.py +46 -30
  44. sp_api/api/solicitations/solicitations.py +20 -11
  45. sp_api/api/supply_sources/supply_sources.py +45 -37
  46. sp_api/api/tokens/tokens.py +4 -6
  47. sp_api/api/upload/upload.py +10 -8
  48. sp_api/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +10 -6
  49. sp_api/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +12 -14
  50. sp_api/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +4 -6
  51. sp_api/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +42 -37
  52. sp_api/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +8 -6
  53. sp_api/api/vendor_invoices/vendor_invoices.py +6 -4
  54. sp_api/api/vendor_orders/vendor_orders.py +16 -19
  55. sp_api/api/vendor_shipments/vendor_shipments.py +91 -262
  56. sp_api/api/vendor_transaction_status/vendor_transaction_status.py +6 -6
  57. sp_api/asyncio/api/__init__.py +167 -0
  58. sp_api/asyncio/api/amazon_warehousing_and_distribu/__init__.py +9 -0
  59. sp_api/asyncio/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +130 -0
  60. sp_api/asyncio/api/aplus_content/__init__.py +5 -0
  61. sp_api/asyncio/api/aplus_content/aplus_content.py +330 -0
  62. sp_api/asyncio/api/application_integrations/__init__.py +5 -0
  63. sp_api/asyncio/api/application_integrations/application_integrations.py +119 -0
  64. sp_api/asyncio/api/application_management/__init__.py +5 -0
  65. sp_api/asyncio/api/application_management/application_management.py +36 -0
  66. sp_api/asyncio/api/authorization/__init__.py +5 -0
  67. sp_api/asyncio/api/authorization/authorization.py +54 -0
  68. sp_api/asyncio/api/catalog/__init__.py +5 -0
  69. sp_api/asyncio/api/catalog/catalog.py +111 -0
  70. sp_api/asyncio/api/catalog_items/__init__.py +6 -0
  71. sp_api/asyncio/api/catalog_items/catalog_items.py +93 -0
  72. sp_api/asyncio/api/clients/__init__.py +1 -0
  73. sp_api/asyncio/api/customer_feedback/__init__.py +5 -0
  74. sp_api/asyncio/api/customer_feedback/customer_feedback.py +111 -0
  75. sp_api/asyncio/api/data_kiosk/__init__.py +5 -0
  76. sp_api/asyncio/api/data_kiosk/data_kiosk.py +236 -0
  77. sp_api/asyncio/api/easy_ship/__init__.py +5 -0
  78. sp_api/asyncio/api/easy_ship/easy_ship.py +191 -0
  79. sp_api/asyncio/api/external_fulfillment/__init__.py +5 -0
  80. sp_api/asyncio/api/external_fulfillment/external_fulfillment.py +706 -0
  81. sp_api/asyncio/api/fba_inbound_eligibility/__init__.py +5 -0
  82. sp_api/asyncio/api/fba_inbound_eligibility/fba_inbound_eligibility.py +96 -0
  83. sp_api/asyncio/api/fba_small_and_light/__init__.py +5 -0
  84. sp_api/asyncio/api/fba_small_and_light/fba_small_and_light.py +213 -0
  85. sp_api/asyncio/api/feeds/feeds.py +260 -0
  86. sp_api/asyncio/api/finances/finances.py +100 -0
  87. sp_api/asyncio/api/fulfillment_inbound/fulfillment_inbound.py +1798 -0
  88. sp_api/asyncio/api/fulfillment_outbound/fulfillment_outbound.py +736 -0
  89. sp_api/asyncio/api/inventories/inventories.py +74 -0
  90. sp_api/asyncio/api/listings_items/__init__.py +0 -0
  91. sp_api/asyncio/api/listings_items/listings_items.py +170 -0
  92. sp_api/asyncio/api/listings_restrictions/__init__.py +0 -0
  93. sp_api/asyncio/api/listings_restrictions/listings_restrictions.py +36 -0
  94. sp_api/asyncio/api/merchant_fulfillment/__init__.py +0 -0
  95. sp_api/asyncio/api/merchant_fulfillment/merchant_fulfillment.py +384 -0
  96. sp_api/asyncio/api/messaging/__init__.py +0 -0
  97. sp_api/asyncio/api/messaging/messaging.py +511 -0
  98. sp_api/asyncio/api/models/__init__.py +4 -0
  99. sp_api/asyncio/api/notifications/__init__.py +0 -0
  100. sp_api/asyncio/api/notifications/notifications.py +295 -0
  101. sp_api/asyncio/api/orders/__init__.py +0 -0
  102. sp_api/asyncio/api/orders/orders.py +412 -0
  103. sp_api/asyncio/api/orders/orders_2026_01_01.py +40 -0
  104. sp_api/asyncio/api/overrides/__init__.py +1 -0
  105. sp_api/asyncio/api/product_fees/__init__.py +0 -0
  106. sp_api/asyncio/api/product_fees/product_fees.py +194 -0
  107. sp_api/asyncio/api/product_type_definitions/__init__.py +0 -0
  108. sp_api/asyncio/api/product_type_definitions/product_type_definitions.py +75 -0
  109. sp_api/asyncio/api/products/__init__.py +0 -0
  110. sp_api/asyncio/api/products/products.py +405 -0
  111. sp_api/asyncio/api/products/products_definitions.py +11 -0
  112. sp_api/asyncio/api/replenishment/__init__.py +0 -0
  113. sp_api/asyncio/api/replenishment/replenishment.py +121 -0
  114. sp_api/asyncio/api/reports/__init__.py +0 -0
  115. sp_api/asyncio/api/reports/reports.py +439 -0
  116. sp_api/asyncio/api/sales/__init__.py +0 -0
  117. sp_api/asyncio/api/sales/sales.py +93 -0
  118. sp_api/asyncio/api/sellers/__init__.py +0 -0
  119. sp_api/asyncio/api/sellers/sellers.py +70 -0
  120. sp_api/asyncio/api/services/__init__.py +0 -0
  121. sp_api/asyncio/api/services/services.py +218 -0
  122. sp_api/asyncio/api/shipping/__init__.py +0 -0
  123. sp_api/asyncio/api/shipping/shipping.py +459 -0
  124. sp_api/asyncio/api/shipping/shippingV2.py +651 -0
  125. sp_api/asyncio/api/solicitations/__init__.py +0 -0
  126. sp_api/asyncio/api/solicitations/solicitations.py +78 -0
  127. sp_api/asyncio/api/supply_sources/__init__.py +0 -0
  128. sp_api/asyncio/api/supply_sources/supply_sources.py +138 -0
  129. sp_api/asyncio/api/tokens/__init__.py +0 -0
  130. sp_api/asyncio/api/tokens/tokens.py +65 -0
  131. sp_api/asyncio/api/upload/__init__.py +0 -0
  132. sp_api/asyncio/api/upload/upload.py +18 -0
  133. sp_api/asyncio/api/vendor_direct_fulfillment_inventory/__init__.py +0 -0
  134. sp_api/asyncio/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +64 -0
  135. sp_api/asyncio/api/vendor_direct_fulfillment_orders/__init__.py +0 -0
  136. sp_api/asyncio/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +196 -0
  137. sp_api/asyncio/api/vendor_direct_fulfillment_payments/__init__.py +0 -0
  138. sp_api/asyncio/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +254 -0
  139. sp_api/asyncio/api/vendor_direct_fulfillment_shipping/__init__.py +0 -0
  140. sp_api/asyncio/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +627 -0
  141. sp_api/asyncio/api/vendor_direct_fulfillment_transactions/__init__.py +0 -0
  142. sp_api/asyncio/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +43 -0
  143. sp_api/asyncio/api/vendor_invoices/__init__.py +0 -0
  144. sp_api/asyncio/api/vendor_invoices/vendor_invoices.py +295 -0
  145. sp_api/asyncio/api/vendor_orders/__init__.py +0 -0
  146. sp_api/asyncio/api/vendor_orders/vendor_orders.py +210 -0
  147. sp_api/asyncio/api/vendor_shipments/__init__.py +0 -0
  148. sp_api/asyncio/api/vendor_shipments/vendor_shipments.py +118 -0
  149. sp_api/asyncio/api/vendor_transaction_status/__init__.py +0 -0
  150. sp_api/asyncio/api/vendor_transaction_status/vendor_transaction_status.py +41 -0
  151. sp_api/asyncio/auth/__init__.py +12 -0
  152. sp_api/asyncio/auth/access_token_client.py +145 -0
  153. sp_api/asyncio/auth/exceptions.py +5 -0
  154. sp_api/asyncio/base/__init__.py +53 -0
  155. sp_api/asyncio/base/_transport_httpx.py +50 -0
  156. sp_api/asyncio/base/base_client.py +8 -0
  157. sp_api/asyncio/base/client.py +169 -0
  158. sp_api/asyncio/util/__init__.py +29 -0
  159. sp_api/asyncio/util/key_maker.py +5 -0
  160. sp_api/asyncio/util/load_all_pages.py +55 -0
  161. sp_api/asyncio/util/load_date_bound.py +53 -0
  162. sp_api/asyncio/util/retry.py +88 -0
  163. sp_api/auth/__init__.py +3 -3
  164. sp_api/auth/_core.py +39 -0
  165. sp_api/auth/access_token_client.py +20 -31
  166. sp_api/auth/access_token_response.py +4 -4
  167. sp_api/base/ApiResponse.py +5 -4
  168. sp_api/base/__init__.py +53 -42
  169. sp_api/base/_core.py +110 -0
  170. sp_api/base/_transport_httpx.py +39 -0
  171. sp_api/base/base_client.py +4 -4
  172. sp_api/base/client.py +131 -112
  173. sp_api/base/credential_provider.py +41 -34
  174. sp_api/base/exceptions.py +14 -3
  175. sp_api/base/feedTypes.py +44 -32
  176. sp_api/base/fulfillment_channel.py +2 -2
  177. sp_api/base/helpers.py +17 -16
  178. sp_api/base/identifiersType.py +8 -8
  179. sp_api/base/included_data.py +12 -12
  180. sp_api/base/marketplaces.py +5 -1
  181. sp_api/base/notifications.py +1 -1
  182. sp_api/base/processing_status.py +5 -5
  183. sp_api/base/reportTypes.py +198 -111
  184. sp_api/base/sales_enum.py +11 -13
  185. sp_api/util/__init__.py +42 -6
  186. sp_api/util/key_maker.py +4 -2
  187. sp_api/util/load_all_pages.py +16 -5
  188. sp_api/util/load_date_bound.py +28 -13
  189. sp_api/util/params.py +57 -0
  190. sp_api/util/product_fees.py +40 -0
  191. sp_api/util/products_definitions.py +169 -0
  192. sp_api/util/report_document.py +154 -0
  193. sp_api/util/retry.py +16 -15
  194. python_amazon_sp_api-1.7.5.dist-info/RECORD +0 -144
  195. tests/api/finances/test_finances.py +0 -19
  196. tests/api/notifications/test_notifications.py +0 -26
  197. tests/api/orders/test_orders.py +0 -122
  198. tests/api/product_fees/product_fees.py +0 -49
  199. tests/api/reports/test_reports.py +0 -127
  200. tests/client/test_auth.py +0 -59
  201. tests/client/test_base.py +0 -163
  202. tests/client/test_credential_provider.py +0 -45
  203. tests/client/test_helpers.py +0 -142
  204. {python_amazon_sp_api-1.7.5.dist-info → python_amazon_sp_api-2.0.10.dist-info/licenses}/LICENSE +0 -0
  205. {tests → sp_api/api/application_integrations}/__init__.py +0 -0
  206. {tests/api → sp_api/api/customer_feedback}/__init__.py +0 -0
  207. {tests/api/finances → sp_api/api/easy_ship}/__init__.py +0 -0
  208. {tests/api/notifications → sp_api/api/external_fulfillment}/__init__.py +0 -0
  209. {tests/api/orders → sp_api/asyncio}/__init__.py +0 -0
  210. {tests/api/product_fees → sp_api/asyncio/api/feeds}/__init__.py +0 -0
  211. {tests/api/reports → sp_api/asyncio/api/finances}/__init__.py +0 -0
  212. {tests/api/sellers → sp_api/asyncio/api/fulfillment_inbound}/__init__.py +0 -0
  213. {tests/client → sp_api/asyncio/api/fulfillment_outbound}/__init__.py +0 -0
  214. /tests/api/sellers/test_sellers.py → /sp_api/asyncio/api/inventories/__init__.py +0 -0
@@ -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
+ )
@@ -0,0 +1,11 @@
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
+ )
File without changes
@@ -0,0 +1,121 @@
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 Replenishment(AsyncBaseClient):
8
+ """
9
+ Replenishment SP-API Client
10
+ :link:
11
+
12
+ 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.
13
+
14
+ 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.
15
+ """
16
+
17
+ @sp_endpoint(
18
+ "/replenishment/2022-11-07/sellingPartners/metrics/search", method="POST"
19
+ )
20
+ async def get_selling_partner_metrics(self, **kwargs) -> ApiResponse:
21
+ """
22
+ get_selling_partner_metrics(self, **kwargs) -> ApiResponse
23
+
24
+ Returns aggregated replenishment program metrics for a selling partner.
25
+
26
+ **Usage Plan:**
27
+
28
+ | Rate (requests per second) | Burst |
29
+ | ---- | ---- |
30
+ | 1 | 1 |
31
+
32
+ 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).
33
+
34
+ Args:
35
+
36
+ body: | {'description': 'The request body for the `getSellingPartnerMetrics` operation.',
37
+ 'properties': {'aggregationFrequency': {'$ref': '#/definitions/AggregationFrequency'},
38
+ 'marketplaceId': {'$ref': '#/definitions/MarketplaceId',
39
+ 'description': 'The marketplace identifier. The supported marketplaces for both sellers and vendors are US, CA, ES, UK, FR, IT, IN, DE and JP. The supported marketplaces for vendors only are BR, AU, MX, AE and NL. '
40
+ 'Refer to [Marketplace IDs](https://developer-docs.amazon.com/sp-api/docs/marketplace-ids) to find the identifier for the marketplace.'},
41
+ 'metrics': {'description': 'The list of metrics requested. If no metric value is provided, data for all of the metrics will be returned.',
42
+ 'items': {'$ref': '#/definitions/Metric'},
43
+ 'minItems': 1,
44
+ 'type': 'array',
45
+ 'uniqueItems': True},
46
+ 'programTypes': {'$ref': '#/definitions/ProgramTypes', 'description': 'The list of replenishment program types for which to return metrics.'},
47
+ 'timeInterval': {'$ref': '#/definitions/TimeInterval', 'description': 'A time interval used to compute metrics.'},
48
+ 'timePeriodType': {'$ref': '#/definitions/TimePeriodType'}},
49
+ 'required': ['timeInterval', 'timePeriodType', 'programTypes', 'marketplaceId'],
50
+ 'type': 'object'}
51
+
52
+
53
+ Returns:
54
+ ApiResponse:
55
+ """
56
+
57
+ return await self._request(kwargs.pop("path"), data=kwargs)
58
+
59
+ @sp_endpoint("/replenishment/2022-11-07/offers/metrics/search", method="POST")
60
+ async def list_offer_metrics(self, **kwargs) -> ApiResponse:
61
+ """
62
+ list_offer_metrics(self, **kwargs) -> ApiResponse
63
+
64
+ Returns aggregated replenishment program metrics for a selling partner's offers.
65
+
66
+ **Usage Plan:**
67
+
68
+ | Rate (requests per second) | Burst |
69
+ | ---- | ---- |
70
+ | 1 | 1 |
71
+
72
+ 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).
73
+
74
+ Args:
75
+
76
+ body: | {'description': 'The request body for the `listOfferMetrics` operation.',
77
+ 'properties': {'filters': {'$ref': '#/definitions/ListOfferMetricsRequestFilters',
78
+ '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.'},
79
+ 'pagination': {'$ref': '#/definitions/ListOfferMetricsRequestPagination', 'description': 'Use these parameters to paginate through the response.'},
80
+ 'sort': {'$ref': '#/definitions/ListOfferMetricsRequestSort', 'description': 'Use these parameters to sort the response.'}},
81
+ 'required': ['pagination', 'filters'],
82
+ 'type': 'object'}
83
+
84
+
85
+ Returns:
86
+ ApiResponse:
87
+ """
88
+
89
+ return await self._request(kwargs.pop("path"), data=kwargs)
90
+
91
+ @sp_endpoint("/replenishment/2022-11-07/offers/search", method="POST")
92
+ async def list_offers(self, **kwargs) -> ApiResponse:
93
+ """
94
+ list_offers(self, **kwargs) -> ApiResponse
95
+
96
+ Returns the details of a selling partner's replenishment program offers. Note that this operation only supports sellers at this time.
97
+
98
+ **Usage Plan:**
99
+
100
+ | Rate (requests per second) | Burst |
101
+ | ---- | ---- |
102
+ | 1 | 1 |
103
+
104
+ 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).
105
+
106
+ Args:
107
+
108
+ body: | {'description': 'The request body for the `listOffers` operation.',
109
+ 'properties': {'filters': {'$ref': '#/definitions/ListOffersRequestFilters',
110
+ '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.'},
111
+ 'pagination': {'$ref': '#/definitions/ListOffersRequestPagination', 'description': 'Use these parameters to paginate through the response.'},
112
+ 'sort': {'$ref': '#/definitions/ListOffersRequestSort', 'description': 'Use these parameters to sort the response.'}},
113
+ 'required': ['pagination', 'filters'],
114
+ 'type': 'object'}
115
+
116
+
117
+ Returns:
118
+ ApiResponse:
119
+ """
120
+
121
+ return await self._request(kwargs.pop("path"), data=kwargs)
File without changes