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.
Files changed (137) hide show
  1. {python_amazon_sp_api-1.9.60.dist-info → python_amazon_sp_api-2.0.3.dist-info}/METADATA +41 -14
  2. python_amazon_sp_api-2.0.3.dist-info/RECORD +249 -0
  3. sp_api/__version__.py +1 -1
  4. sp_api/api/catalog/catalog.py +3 -4
  5. sp_api/api/catalog_items/catalog_items.py +3 -6
  6. sp_api/api/data_kiosk/data_kiosk.py +5 -6
  7. sp_api/api/feeds/feeds.py +11 -8
  8. sp_api/api/fulfillment_inbound/fulfillment_inbound.py +2 -2
  9. sp_api/api/inventories/inventories.py +2 -7
  10. sp_api/api/listings_items/listings_items.py +3 -24
  11. sp_api/api/products/products.py +3 -1
  12. sp_api/api/reports/reports.py +61 -97
  13. sp_api/api/sales/sales.py +2 -2
  14. sp_api/asyncio/__init__.py +0 -0
  15. sp_api/asyncio/api/__init__.py +164 -0
  16. sp_api/asyncio/api/amazon_warehousing_and_distribu/__init__.py +9 -0
  17. sp_api/asyncio/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +130 -0
  18. sp_api/asyncio/api/aplus_content/__init__.py +5 -0
  19. sp_api/asyncio/api/aplus_content/aplus_content.py +330 -0
  20. sp_api/asyncio/api/application_integrations/__init__.py +5 -0
  21. sp_api/asyncio/api/application_integrations/application_integrations.py +119 -0
  22. sp_api/asyncio/api/application_management/__init__.py +5 -0
  23. sp_api/asyncio/api/application_management/application_management.py +36 -0
  24. sp_api/asyncio/api/authorization/__init__.py +5 -0
  25. sp_api/asyncio/api/authorization/authorization.py +54 -0
  26. sp_api/asyncio/api/catalog/__init__.py +5 -0
  27. sp_api/asyncio/api/catalog/catalog.py +111 -0
  28. sp_api/asyncio/api/catalog_items/__init__.py +6 -0
  29. sp_api/asyncio/api/catalog_items/catalog_items.py +93 -0
  30. sp_api/asyncio/api/clients/__init__.py +1 -0
  31. sp_api/asyncio/api/customer_feedback/__init__.py +5 -0
  32. sp_api/asyncio/api/customer_feedback/customer_feedback.py +111 -0
  33. sp_api/asyncio/api/data_kiosk/__init__.py +5 -0
  34. sp_api/asyncio/api/data_kiosk/data_kiosk.py +236 -0
  35. sp_api/asyncio/api/easy_ship/__init__.py +5 -0
  36. sp_api/asyncio/api/easy_ship/easy_ship.py +191 -0
  37. sp_api/asyncio/api/external_fulfillment/__init__.py +5 -0
  38. sp_api/asyncio/api/external_fulfillment/external_fulfillment.py +706 -0
  39. sp_api/asyncio/api/fba_inbound_eligibility/__init__.py +5 -0
  40. sp_api/asyncio/api/fba_inbound_eligibility/fba_inbound_eligibility.py +96 -0
  41. sp_api/asyncio/api/fba_small_and_light/__init__.py +5 -0
  42. sp_api/asyncio/api/fba_small_and_light/fba_small_and_light.py +213 -0
  43. sp_api/asyncio/api/feeds/__init__.py +0 -0
  44. sp_api/asyncio/api/feeds/feeds.py +260 -0
  45. sp_api/asyncio/api/finances/__init__.py +0 -0
  46. sp_api/asyncio/api/finances/finances.py +100 -0
  47. sp_api/asyncio/api/fulfillment_inbound/__init__.py +0 -0
  48. sp_api/asyncio/api/fulfillment_inbound/fulfillment_inbound.py +1798 -0
  49. sp_api/asyncio/api/fulfillment_outbound/__init__.py +0 -0
  50. sp_api/asyncio/api/fulfillment_outbound/fulfillment_outbound.py +736 -0
  51. sp_api/asyncio/api/inventories/__init__.py +0 -0
  52. sp_api/asyncio/api/inventories/inventories.py +74 -0
  53. sp_api/asyncio/api/listings_items/__init__.py +0 -0
  54. sp_api/asyncio/api/listings_items/listings_items.py +170 -0
  55. sp_api/asyncio/api/listings_restrictions/__init__.py +0 -0
  56. sp_api/asyncio/api/listings_restrictions/listings_restrictions.py +36 -0
  57. sp_api/asyncio/api/merchant_fulfillment/__init__.py +0 -0
  58. sp_api/asyncio/api/merchant_fulfillment/merchant_fulfillment.py +384 -0
  59. sp_api/asyncio/api/messaging/__init__.py +0 -0
  60. sp_api/asyncio/api/messaging/messaging.py +511 -0
  61. sp_api/asyncio/api/models/__init__.py +4 -0
  62. sp_api/asyncio/api/notifications/__init__.py +0 -0
  63. sp_api/asyncio/api/notifications/notifications.py +295 -0
  64. sp_api/asyncio/api/orders/__init__.py +0 -0
  65. sp_api/asyncio/api/orders/orders.py +356 -0
  66. sp_api/asyncio/api/overrides/__init__.py +1 -0
  67. sp_api/asyncio/api/product_fees/__init__.py +0 -0
  68. sp_api/asyncio/api/product_fees/product_fees.py +237 -0
  69. sp_api/asyncio/api/product_type_definitions/__init__.py +0 -0
  70. sp_api/asyncio/api/product_type_definitions/product_type_definitions.py +75 -0
  71. sp_api/asyncio/api/products/__init__.py +0 -0
  72. sp_api/asyncio/api/products/products.py +405 -0
  73. sp_api/asyncio/api/products/products_definitions.py +170 -0
  74. sp_api/asyncio/api/replenishment/__init__.py +0 -0
  75. sp_api/asyncio/api/replenishment/replenishment.py +121 -0
  76. sp_api/asyncio/api/reports/__init__.py +0 -0
  77. sp_api/asyncio/api/reports/reports.py +439 -0
  78. sp_api/asyncio/api/sales/__init__.py +0 -0
  79. sp_api/asyncio/api/sales/sales.py +93 -0
  80. sp_api/asyncio/api/sellers/__init__.py +0 -0
  81. sp_api/asyncio/api/sellers/sellers.py +70 -0
  82. sp_api/asyncio/api/services/__init__.py +0 -0
  83. sp_api/asyncio/api/services/services.py +218 -0
  84. sp_api/asyncio/api/shipping/__init__.py +0 -0
  85. sp_api/asyncio/api/shipping/shipping.py +459 -0
  86. sp_api/asyncio/api/shipping/shippingV2.py +651 -0
  87. sp_api/asyncio/api/solicitations/__init__.py +0 -0
  88. sp_api/asyncio/api/solicitations/solicitations.py +78 -0
  89. sp_api/asyncio/api/supply_sources/__init__.py +0 -0
  90. sp_api/asyncio/api/supply_sources/supply_sources.py +138 -0
  91. sp_api/asyncio/api/tokens/__init__.py +0 -0
  92. sp_api/asyncio/api/tokens/tokens.py +65 -0
  93. sp_api/asyncio/api/upload/__init__.py +0 -0
  94. sp_api/asyncio/api/upload/upload.py +18 -0
  95. sp_api/asyncio/api/vendor_direct_fulfillment_inventory/__init__.py +0 -0
  96. sp_api/asyncio/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +64 -0
  97. sp_api/asyncio/api/vendor_direct_fulfillment_orders/__init__.py +0 -0
  98. sp_api/asyncio/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +196 -0
  99. sp_api/asyncio/api/vendor_direct_fulfillment_payments/__init__.py +0 -0
  100. sp_api/asyncio/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +254 -0
  101. sp_api/asyncio/api/vendor_direct_fulfillment_shipping/__init__.py +0 -0
  102. sp_api/asyncio/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +627 -0
  103. sp_api/asyncio/api/vendor_direct_fulfillment_transactions/__init__.py +0 -0
  104. sp_api/asyncio/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +43 -0
  105. sp_api/asyncio/api/vendor_invoices/__init__.py +0 -0
  106. sp_api/asyncio/api/vendor_invoices/vendor_invoices.py +295 -0
  107. sp_api/asyncio/api/vendor_orders/__init__.py +0 -0
  108. sp_api/asyncio/api/vendor_orders/vendor_orders.py +210 -0
  109. sp_api/asyncio/api/vendor_shipments/__init__.py +0 -0
  110. sp_api/asyncio/api/vendor_shipments/vendor_shipments.py +118 -0
  111. sp_api/asyncio/api/vendor_transaction_status/__init__.py +0 -0
  112. sp_api/asyncio/api/vendor_transaction_status/vendor_transaction_status.py +41 -0
  113. sp_api/asyncio/auth/__init__.py +12 -0
  114. sp_api/asyncio/auth/access_token_client.py +145 -0
  115. sp_api/asyncio/auth/exceptions.py +5 -0
  116. sp_api/asyncio/base/__init__.py +53 -0
  117. sp_api/asyncio/base/_transport_httpx.py +50 -0
  118. sp_api/asyncio/base/base_client.py +8 -0
  119. sp_api/asyncio/base/client.py +169 -0
  120. sp_api/asyncio/util/__init__.py +29 -0
  121. sp_api/asyncio/util/key_maker.py +5 -0
  122. sp_api/asyncio/util/load_all_pages.py +55 -0
  123. sp_api/asyncio/util/load_date_bound.py +53 -0
  124. sp_api/asyncio/util/retry.py +88 -0
  125. sp_api/auth/_core.py +39 -0
  126. sp_api/auth/access_token_client.py +18 -30
  127. sp_api/base/_core.py +110 -0
  128. sp_api/base/_transport_httpx.py +39 -0
  129. sp_api/base/client.py +40 -63
  130. sp_api/util/__init__.py +16 -0
  131. sp_api/util/params.py +57 -0
  132. sp_api/util/report_document.py +154 -0
  133. python_amazon_sp_api-1.9.60.dist-info/RECORD +0 -133
  134. {python_amazon_sp_api-1.9.60.data → python_amazon_sp_api-2.0.3.data}/scripts/make_endpoint +0 -0
  135. {python_amazon_sp_api-1.9.60.dist-info → python_amazon_sp_api-2.0.3.dist-info}/WHEEL +0 -0
  136. {python_amazon_sp_api-1.9.60.dist-info → python_amazon_sp_api-2.0.3.dist-info}/licenses/LICENSE +0 -0
  137. {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,237 @@
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 Client, ApiResponse
6
+ from sp_api.asyncio.base import AsyncBaseClient
7
+
8
+
9
+ class ProductFees(AsyncBaseClient):
10
+ """
11
+ :link: https://github.com/amzn/selling-partner-api-docs/tree/main/references/product-fees-api
12
+ """
13
+
14
+ @sp_endpoint("/products/fees/v0/listings/{}/feesEstimate", method="POST")
15
+ async def get_product_fees_estimate_for_sku(
16
+ self,
17
+ seller_sku,
18
+ price: float,
19
+ shipping_price=None,
20
+ currency="USD",
21
+ is_fba=False,
22
+ points: dict = None,
23
+ marketplace_id: str = None,
24
+ optional_fulfillment_program: str = None,
25
+ force_safe_sku: bool = True,
26
+ **kwargs
27
+ ) -> ApiResponse:
28
+ """
29
+ get_product_fees_estimate_for_sku(self, seller_sku, price: float, shipping_price=None, currency='USD', is_fba=False, points: dict = dict, **kwargs) -> ApiResponse
30
+
31
+ Returns fees for sku
32
+
33
+ Examples:
34
+ literal blocks::
35
+
36
+ ProductFees().get_product_fees_estimate_for_sku("UmaS1", 10, currency='USD', shipping_price=10, is_fba=False,
37
+ points={
38
+ "PointsNumber": 0,
39
+ "PointsMonetaryValue": {
40
+ "CurrencyCode": "USD",
41
+ "Amount": 0
42
+ }
43
+ })
44
+
45
+ Args:
46
+ seller_sku:
47
+ price:
48
+ shipping_price:
49
+ currency:
50
+ is_fba:
51
+ points:
52
+ marketplace_id: str | Defaults to self.marketplace_id
53
+ optional_fulfillment_program:
54
+ force_safe_sku: bool | Force user SKU quote
55
+ **kwargs:
56
+
57
+ Returns:
58
+ ApiResponse:
59
+
60
+ """
61
+
62
+ if force_safe_sku:
63
+ # handle `forward slash` issue in SKU
64
+ seller_sku = quote_plus(seller_sku)
65
+
66
+ kwargs.update(
67
+ self._create_body(
68
+ price,
69
+ shipping_price,
70
+ currency,
71
+ is_fba,
72
+ seller_sku,
73
+ points,
74
+ marketplace_id,
75
+ optional_fulfillment_program,
76
+ )
77
+ )
78
+ return await self._request(
79
+ fill_query_params(kwargs.pop("path"), seller_sku), data=kwargs
80
+ )
81
+
82
+ @sp_endpoint("/products/fees/v0/items/{}/feesEstimate", method="POST")
83
+ async def get_product_fees_estimate_for_asin(
84
+ self,
85
+ asin,
86
+ price: float,
87
+ currency="USD",
88
+ shipping_price=None,
89
+ is_fba=False,
90
+ points: dict = None,
91
+ marketplace_id: str = None,
92
+ optional_fulfillment_program: str = None,
93
+ **kwargs
94
+ ) -> ApiResponse:
95
+ """
96
+ get_product_fees_estimate_for_asin(self, asin, price: float, currency='USD', shipping_price=None, is_fba=False, points: dict = dict, **kwargs) -> ApiResponse
97
+
98
+ Returns fees for asin
99
+
100
+ Examples:
101
+ literal blocks::
102
+
103
+ ProductFees().get_product_fees_estimate_for_asin("UmaS1", 10, currency='USD', shipping_price=10, is_fba=False,
104
+ points={
105
+ "PointsNumber": 0,
106
+ "PointsMonetaryValue": {
107
+ "CurrencyCode": "USD",
108
+ "Amount": 0
109
+ }
110
+ })
111
+
112
+ Args:
113
+ asin:
114
+ price:
115
+ currency:
116
+ shipping_price:
117
+ is_fba:
118
+ points:
119
+ marketplace_id: str | Defaults to self.marketplace_id
120
+ optional_fulfillment_program:
121
+ **kwargs:
122
+
123
+ Returns:
124
+ ApiResponse:
125
+
126
+ """
127
+ kwargs.update(
128
+ self._create_body(
129
+ price,
130
+ shipping_price,
131
+ currency,
132
+ is_fba,
133
+ asin,
134
+ points,
135
+ marketplace_id,
136
+ optional_fulfillment_program,
137
+ )
138
+ )
139
+ return await self._request(fill_query_params(kwargs.pop("path"), asin), data=kwargs)
140
+
141
+ async def get_product_fees_estimate(self, estimate_requests: List[dict]) -> ApiResponse:
142
+ """
143
+ get_product_fees_estimate(self, estimate_requests: List[dict]) -> ApiResponse
144
+
145
+ Return fees for multiple products
146
+
147
+ Examples:
148
+ literal blocks::
149
+
150
+ ProductFees().get_product_fees_estimate(
151
+ [
152
+ dict(id_type='ASIN', id_value='B012345678', price=100),
153
+ dict(id_type='ASIN', id_value='B012345678', price=50, is_fba=True),
154
+ ]
155
+ )
156
+
157
+
158
+ Args:
159
+ estimate_requests: list of dict where the allowed keys are :
160
+ id_type: str | ASIN or SellerSKU
161
+ id_value: str
162
+ price:
163
+ currency:
164
+ shipping_price:
165
+ is_fba:
166
+ points:
167
+ marketplace_id: str | Defaults to self.marketplace_id
168
+ optional_fulfillment_program:
169
+ """
170
+ data = [dict(**self._create_body(**er)) for er in estimate_requests]
171
+ return await self._request(
172
+ "/products/fees/v0/feesEstimate",
173
+ data=data,
174
+ params=dict(method="POST"),
175
+ wrap_list=True,
176
+ )
177
+
178
+ def _create_body(
179
+ self,
180
+ price,
181
+ shipping_price=None,
182
+ currency="USD",
183
+ is_fba=False,
184
+ identifier=None,
185
+ points: dict = None,
186
+ marketplace_id: str = None,
187
+ optional_fulfillment_program: str = None,
188
+ id_type=None,
189
+ id_value=None,
190
+ ):
191
+ """
192
+ Create request body
193
+
194
+ Args:
195
+ price:
196
+ shipping_price:
197
+ currency:
198
+ is_fba:
199
+ identifier:
200
+ points:
201
+
202
+ Returns:
203
+
204
+ """
205
+ body = {
206
+ "FeesEstimateRequest": {
207
+ "Identifier": identifier or str(price),
208
+ "PriceToEstimateFees": {
209
+ "ListingPrice": {"Amount": price, "CurrencyCode": currency},
210
+ "Shipping": (
211
+ {"Amount": shipping_price, "CurrencyCode": currency}
212
+ if shipping_price
213
+ else None
214
+ ),
215
+ "Points": points or None,
216
+ },
217
+ "IsAmazonFulfilled": is_fba,
218
+ "OptionalFulfillmentProgram": (
219
+ optional_fulfillment_program
220
+ if is_fba is True and optional_fulfillment_program
221
+ else None
222
+ ),
223
+ "MarketplaceId": marketplace_id or self.marketplace_id,
224
+ }
225
+ }
226
+
227
+ if id_type and id_value:
228
+ body["IdType"] = id_type
229
+ body["IdValue"] = id_value
230
+
231
+ return body
232
+
233
+ def _add_marketplaces(self, data):
234
+ # MarketplaceID is a property of the body's FeesEstimateRequest for this section, and does
235
+ # not need to be added. Additionally, Client._add_marketplaces will fail as it assumes
236
+ # data is a dict, which is not the case for get_product_fees_estimate.
237
+ 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