python-amazon-sp-api 1.9.39__py3-none-any.whl → 2.0.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_amazon_sp_api-1.9.39.dist-info → python_amazon_sp_api-2.0.10.dist-info}/METADATA +44 -8
- python_amazon_sp_api-2.0.10.dist-info/RECORD +253 -0
- {python_amazon_sp_api-1.9.39.dist-info → python_amazon_sp_api-2.0.10.dist-info}/WHEEL +1 -1
- {python_amazon_sp_api-1.9.39.dist-info → python_amazon_sp_api-2.0.10.dist-info}/top_level.txt +0 -1
- sp_api/__version__.py +1 -1
- sp_api/api/__init__.py +9 -3
- sp_api/api/application_integrations/application_integrations.py +2 -2
- sp_api/api/catalog/catalog.py +3 -4
- sp_api/api/catalog_items/catalog_items.py +3 -6
- sp_api/api/customer_feedback/customer_feedback.py +110 -0
- sp_api/api/data_kiosk/data_kiosk.py +5 -6
- sp_api/api/easy_ship/easy_ship.py +5 -5
- sp_api/api/external_fulfillment/external_fulfillment.py +706 -0
- sp_api/api/feeds/feeds.py +11 -8
- sp_api/api/fulfillment_inbound/fulfillment_inbound.py +35 -2
- sp_api/api/inventories/inventories.py +2 -7
- sp_api/api/listings_items/listings_items.py +3 -24
- sp_api/api/messaging/messaging.py +42 -0
- sp_api/api/orders/orders.py +59 -3
- sp_api/api/orders/orders_2026_01_01.py +54 -0
- sp_api/api/product_fees/product_fees.py +31 -74
- sp_api/api/products/products.py +3 -1
- sp_api/api/products/products_definitions.py +11 -169
- sp_api/api/reports/reports.py +61 -96
- sp_api/api/sales/sales.py +2 -2
- sp_api/asyncio/api/__init__.py +167 -0
- sp_api/asyncio/api/amazon_warehousing_and_distribu/__init__.py +9 -0
- sp_api/asyncio/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +130 -0
- sp_api/asyncio/api/aplus_content/__init__.py +5 -0
- sp_api/asyncio/api/aplus_content/aplus_content.py +330 -0
- sp_api/asyncio/api/application_integrations/__init__.py +5 -0
- sp_api/asyncio/api/application_integrations/application_integrations.py +119 -0
- sp_api/asyncio/api/application_management/__init__.py +5 -0
- sp_api/asyncio/api/application_management/application_management.py +36 -0
- sp_api/asyncio/api/authorization/__init__.py +5 -0
- sp_api/asyncio/api/authorization/authorization.py +54 -0
- sp_api/asyncio/api/catalog/__init__.py +5 -0
- sp_api/asyncio/api/catalog/catalog.py +111 -0
- sp_api/asyncio/api/catalog_items/__init__.py +6 -0
- sp_api/asyncio/api/catalog_items/catalog_items.py +93 -0
- sp_api/asyncio/api/clients/__init__.py +1 -0
- sp_api/asyncio/api/customer_feedback/__init__.py +5 -0
- sp_api/asyncio/api/customer_feedback/customer_feedback.py +111 -0
- sp_api/asyncio/api/data_kiosk/__init__.py +5 -0
- sp_api/asyncio/api/data_kiosk/data_kiosk.py +236 -0
- sp_api/asyncio/api/easy_ship/__init__.py +5 -0
- sp_api/asyncio/api/easy_ship/easy_ship.py +191 -0
- sp_api/asyncio/api/external_fulfillment/__init__.py +5 -0
- sp_api/asyncio/api/external_fulfillment/external_fulfillment.py +706 -0
- sp_api/asyncio/api/fba_inbound_eligibility/__init__.py +5 -0
- sp_api/asyncio/api/fba_inbound_eligibility/fba_inbound_eligibility.py +96 -0
- sp_api/asyncio/api/fba_small_and_light/__init__.py +5 -0
- sp_api/asyncio/api/fba_small_and_light/fba_small_and_light.py +213 -0
- sp_api/asyncio/api/feeds/feeds.py +260 -0
- sp_api/asyncio/api/finances/finances.py +100 -0
- sp_api/asyncio/api/fulfillment_inbound/fulfillment_inbound.py +1798 -0
- sp_api/asyncio/api/fulfillment_outbound/fulfillment_outbound.py +736 -0
- sp_api/asyncio/api/inventories/inventories.py +74 -0
- sp_api/asyncio/api/listings_items/listings_items.py +170 -0
- sp_api/asyncio/api/listings_restrictions/listings_restrictions.py +36 -0
- sp_api/asyncio/api/merchant_fulfillment/__init__.py +0 -0
- sp_api/asyncio/api/merchant_fulfillment/merchant_fulfillment.py +384 -0
- sp_api/asyncio/api/messaging/__init__.py +0 -0
- sp_api/asyncio/api/messaging/messaging.py +511 -0
- sp_api/asyncio/api/models/__init__.py +4 -0
- sp_api/asyncio/api/notifications/__init__.py +0 -0
- sp_api/asyncio/api/notifications/notifications.py +295 -0
- sp_api/asyncio/api/orders/__init__.py +0 -0
- sp_api/asyncio/api/orders/orders.py +412 -0
- sp_api/asyncio/api/orders/orders_2026_01_01.py +40 -0
- sp_api/asyncio/api/overrides/__init__.py +1 -0
- sp_api/asyncio/api/product_fees/__init__.py +0 -0
- sp_api/asyncio/api/product_fees/product_fees.py +194 -0
- sp_api/asyncio/api/product_type_definitions/__init__.py +0 -0
- sp_api/asyncio/api/product_type_definitions/product_type_definitions.py +75 -0
- sp_api/asyncio/api/products/__init__.py +0 -0
- sp_api/asyncio/api/products/products.py +405 -0
- sp_api/asyncio/api/products/products_definitions.py +11 -0
- sp_api/asyncio/api/replenishment/__init__.py +0 -0
- sp_api/asyncio/api/replenishment/replenishment.py +121 -0
- sp_api/asyncio/api/reports/__init__.py +0 -0
- sp_api/asyncio/api/reports/reports.py +439 -0
- sp_api/asyncio/api/sales/__init__.py +0 -0
- sp_api/asyncio/api/sales/sales.py +93 -0
- sp_api/asyncio/api/sellers/__init__.py +0 -0
- sp_api/asyncio/api/sellers/sellers.py +70 -0
- sp_api/asyncio/api/services/__init__.py +0 -0
- sp_api/asyncio/api/services/services.py +218 -0
- sp_api/asyncio/api/shipping/__init__.py +0 -0
- sp_api/asyncio/api/shipping/shipping.py +459 -0
- sp_api/asyncio/api/shipping/shippingV2.py +651 -0
- sp_api/asyncio/api/solicitations/__init__.py +0 -0
- sp_api/asyncio/api/solicitations/solicitations.py +78 -0
- sp_api/asyncio/api/supply_sources/__init__.py +0 -0
- sp_api/asyncio/api/supply_sources/supply_sources.py +138 -0
- sp_api/asyncio/api/tokens/__init__.py +0 -0
- sp_api/asyncio/api/tokens/tokens.py +65 -0
- sp_api/asyncio/api/upload/__init__.py +0 -0
- sp_api/asyncio/api/upload/upload.py +18 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_inventory/__init__.py +0 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +64 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_orders/__init__.py +0 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +196 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_payments/__init__.py +0 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +254 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_shipping/__init__.py +0 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +627 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_transactions/__init__.py +0 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +43 -0
- sp_api/asyncio/api/vendor_invoices/__init__.py +0 -0
- sp_api/asyncio/api/vendor_invoices/vendor_invoices.py +295 -0
- sp_api/asyncio/api/vendor_orders/__init__.py +0 -0
- sp_api/asyncio/api/vendor_orders/vendor_orders.py +210 -0
- sp_api/asyncio/api/vendor_shipments/__init__.py +0 -0
- sp_api/asyncio/api/vendor_shipments/vendor_shipments.py +118 -0
- sp_api/asyncio/api/vendor_transaction_status/__init__.py +0 -0
- sp_api/asyncio/api/vendor_transaction_status/vendor_transaction_status.py +41 -0
- sp_api/asyncio/auth/__init__.py +12 -0
- sp_api/asyncio/auth/access_token_client.py +145 -0
- sp_api/asyncio/auth/exceptions.py +5 -0
- sp_api/asyncio/base/__init__.py +53 -0
- sp_api/asyncio/base/_transport_httpx.py +50 -0
- sp_api/asyncio/base/base_client.py +8 -0
- sp_api/asyncio/base/client.py +169 -0
- sp_api/asyncio/util/__init__.py +29 -0
- sp_api/asyncio/util/key_maker.py +5 -0
- sp_api/asyncio/util/load_all_pages.py +55 -0
- sp_api/asyncio/util/load_date_bound.py +53 -0
- sp_api/asyncio/util/retry.py +88 -0
- sp_api/auth/_core.py +39 -0
- sp_api/auth/access_token_client.py +18 -29
- sp_api/base/ApiResponse.py +2 -2
- sp_api/base/_core.py +110 -0
- sp_api/base/_transport_httpx.py +39 -0
- sp_api/base/client.py +40 -63
- sp_api/base/helpers.py +1 -1
- sp_api/util/__init__.py +36 -0
- sp_api/util/params.py +57 -0
- sp_api/util/product_fees.py +40 -0
- sp_api/util/products_definitions.py +169 -0
- sp_api/util/report_document.py +154 -0
- python_amazon_sp_api-1.9.39.dist-info/RECORD +0 -148
- tests/api/finances/test_finances.py +0 -19
- tests/api/notifications/test_notifications.py +0 -26
- tests/api/orders/test_orders.py +0 -122
- tests/api/product_fees/product_fees.py +0 -49
- tests/api/reports/test_reports.py +0 -127
- tests/client/test_auth.py +0 -59
- tests/client/test_base.py +0 -163
- tests/client/test_credential_provider.py +0 -45
- tests/client/test_helpers.py +0 -142
- {python_amazon_sp_api-1.9.39.data → python_amazon_sp_api-2.0.10.data}/scripts/make_endpoint +0 -0
- {python_amazon_sp_api-1.9.39.dist-info → python_amazon_sp_api-2.0.10.dist-info}/licenses/LICENSE +0 -0
- {tests → sp_api/api/customer_feedback}/__init__.py +0 -0
- {tests/api → sp_api/api/external_fulfillment}/__init__.py +0 -0
- {tests/api/finances → sp_api/asyncio}/__init__.py +0 -0
- {tests/api/notifications → sp_api/asyncio/api/feeds}/__init__.py +0 -0
- {tests/api/orders → sp_api/asyncio/api/finances}/__init__.py +0 -0
- {tests/api/product_fees → sp_api/asyncio/api/fulfillment_inbound}/__init__.py +0 -0
- {tests/api/reports → sp_api/asyncio/api/fulfillment_outbound}/__init__.py +0 -0
- {tests/api/sellers → sp_api/asyncio/api/inventories}/__init__.py +0 -0
- {tests/client → sp_api/asyncio/api/listings_items}/__init__.py +0 -0
- /tests/api/sellers/test_sellers.py → /sp_api/asyncio/api/listings_restrictions/__init__.py +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import urllib.parse
|
|
2
|
+
|
|
3
|
+
from sp_api.base import (
|
|
4
|
+
ApiResponse,
|
|
5
|
+
IneligibilityReasonList,
|
|
6
|
+
fill_query_params,
|
|
7
|
+
sp_endpoint,
|
|
8
|
+
)
|
|
9
|
+
from sp_api.asyncio.base import AsyncBaseClient
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class FbaInboundEligibility(AsyncBaseClient):
|
|
13
|
+
"""
|
|
14
|
+
FbaInboundEligibility SP-API Client
|
|
15
|
+
:link:
|
|
16
|
+
|
|
17
|
+
With the FBA Inbound Eligibility API, you can build applications that let sellers get eligibility previews for items before shipping them to Amazon's fulfillment centers. With this API you can find out if an item is eligible for inbound shipment to Amazon's fulfillment centers in a specific marketplace. You can also find out if an item is eligible for using the manufacturer barcode for FBA inventory tracking. Sellers can use this information to inform their decisions about which items to ship Amazon's fulfillment centers.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
@sp_endpoint("/fba/inbound/v1/eligibility/itemPreview", method="GET")
|
|
21
|
+
async def get_item_eligibility_preview(self, **kwargs) -> ApiResponse:
|
|
22
|
+
"""
|
|
23
|
+
get_item_eligibility_preview(self, **kwargs) -> ApiResponse
|
|
24
|
+
|
|
25
|
+
This operation gets an eligibility preview for an item that you specify. You can specify the type of eligibility preview that you want (INBOUND or COMMINGLING). For INBOUND previews, you can specify the marketplace in which you want to determine the item's eligibility.
|
|
26
|
+
|
|
27
|
+
**Usage Plan:**
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
====================================== ==============
|
|
31
|
+
Rate (requests per second) Burst
|
|
32
|
+
====================================== ==============
|
|
33
|
+
1 1
|
|
34
|
+
====================================== ==============
|
|
35
|
+
|
|
36
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
key marketplaceIds:array | The identifier for the marketplace in which you want to determine eligibility. Required only when program=INBOUND.
|
|
40
|
+
key asin:string | * REQUIRED The ASIN of the item for which you want an eligibility preview.
|
|
41
|
+
key program:string | * REQUIRED The program that you want to check eligibility against.
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
Returns:
|
|
45
|
+
ApiResponse:
|
|
46
|
+
"""
|
|
47
|
+
return await self._request(kwargs.pop("path"), params=kwargs)
|
|
48
|
+
|
|
49
|
+
@sp_endpoint("/fba/inbound/v1/eligibility/itemPreview", method="GET")
|
|
50
|
+
async def get_item_eligibility_preview_extended(self, **kwargs) -> ApiResponse:
|
|
51
|
+
"""
|
|
52
|
+
get_item_eligibility_preview_extended(self, **kwargs) -> ApiResponse
|
|
53
|
+
|
|
54
|
+
This operation gets an eligibility preview for an item that you specify. You can specify the type of eligibility preview that you want (INBOUND or COMMINGLING). For INBOUND previews, you can specify the marketplace in which you want to determine the item's eligibility.
|
|
55
|
+
|
|
56
|
+
**Usage Plan:**
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
====================================== ==============
|
|
60
|
+
Rate (requests per second) Burst
|
|
61
|
+
====================================== ==============
|
|
62
|
+
1 1
|
|
63
|
+
====================================== ==============
|
|
64
|
+
|
|
65
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
key marketplaceIds:array | The identifier for the marketplace in which you want to determine eligibility. Required only when program=INBOUND.
|
|
69
|
+
key asin:string | * REQUIRED The ASIN of the item for which you want an eligibility preview.
|
|
70
|
+
key program:string | * REQUIRED The program that you want to check eligibility against.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
ApiResponse:
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
api_response = await self._request(kwargs.pop("path"), params=kwargs)
|
|
78
|
+
|
|
79
|
+
if (
|
|
80
|
+
api_response.payload.get("ineligibilityReasonList")
|
|
81
|
+
and api_response.payload.get("isEligibleForProgram") is False
|
|
82
|
+
):
|
|
83
|
+
ineligibility_list = api_response.payload.get("ineligibilityReasonList")
|
|
84
|
+
errors = []
|
|
85
|
+
for ineligibility_option in ineligibility_list:
|
|
86
|
+
try:
|
|
87
|
+
errors.append(
|
|
88
|
+
ineligibility_option
|
|
89
|
+
+ ": "
|
|
90
|
+
+ IneligibilityReasonList[ineligibility_option].value
|
|
91
|
+
)
|
|
92
|
+
except KeyError as error:
|
|
93
|
+
errors.append(error)
|
|
94
|
+
api_response.payload.update({"ineligibilityReasonListMessage": errors})
|
|
95
|
+
|
|
96
|
+
return api_response
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import urllib.parse
|
|
2
|
+
|
|
3
|
+
from sp_api.base import ApiResponse, deprecated, fill_query_params, sp_endpoint
|
|
4
|
+
from sp_api.asyncio.base import AsyncBaseClient
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class FbaSmallAndLight(AsyncBaseClient):
|
|
8
|
+
"""
|
|
9
|
+
FbaSmallAndLight SP-API Client
|
|
10
|
+
:link:
|
|
11
|
+
|
|
12
|
+
The Selling Partner API for FBA Small and Light lets you help sellers manage their listings in the Small and Light program. The program reduces the cost of fulfilling orders for small and lightweight FBA inventory. You can enroll or remove items from the program and check item eligibility and enrollment status. You can also preview the estimated program fees charged to a seller for items sold while enrolled in the program.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
@deprecated
|
|
16
|
+
async def get_small_and_light_enrollment_by_seller_s_k_u(
|
|
17
|
+
self, sellerSKU, **kwargs
|
|
18
|
+
) -> ApiResponse:
|
|
19
|
+
return await self.get_small_and_light_enrollment_by_seller_sku(
|
|
20
|
+
sellerSKU, **kwargs
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
@sp_endpoint("/fba/smallAndLight/v1/enrollments/{}", method="GET")
|
|
24
|
+
async def get_small_and_light_enrollment_by_seller_sku(
|
|
25
|
+
self, seller_sku, **kwargs
|
|
26
|
+
) -> ApiResponse:
|
|
27
|
+
"""
|
|
28
|
+
get_small_and_light_enrollment_by_seller_s_k_u(self, sellerSKU, **kwargs) -> ApiResponse
|
|
29
|
+
|
|
30
|
+
Returns the Small and Light enrollment status for the item indicated by the specified seller SKU in the specified marketplace.
|
|
31
|
+
|
|
32
|
+
**Usage Plan:**
|
|
33
|
+
|
|
34
|
+
====================================== ==============
|
|
35
|
+
Rate (requests per second) Burst
|
|
36
|
+
====================================== ==============
|
|
37
|
+
2 10
|
|
38
|
+
====================================== ==============
|
|
39
|
+
|
|
40
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
seller_sku:string | * REQUIRED The seller SKU that identifies the item.
|
|
44
|
+
key marketplaceIds:array | * REQUIRED The marketplace for which the enrollment status is retrieved. Note: Accepts a single marketplace only.
|
|
45
|
+
|
|
46
|
+
Returns:
|
|
47
|
+
ApiResponse:
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
return await self._request(
|
|
51
|
+
fill_query_params(kwargs.pop("path"), seller_sku), params=kwargs
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
@deprecated
|
|
55
|
+
async def put_small_and_light_enrollment_by_seller_s_k_u(
|
|
56
|
+
self, sellerSKU, **kwargs
|
|
57
|
+
) -> ApiResponse:
|
|
58
|
+
return await self.put_small_and_light_enrollment_by_seller_sku(
|
|
59
|
+
sellerSKU, **kwargs
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
@sp_endpoint("/fba/smallAndLight/v1/enrollments/{}", method="PUT")
|
|
63
|
+
async def put_small_and_light_enrollment_by_seller_sku(
|
|
64
|
+
self, seller_sku, **kwargs
|
|
65
|
+
) -> ApiResponse:
|
|
66
|
+
"""
|
|
67
|
+
put_small_and_light_enrollment_by_seller_s_k_u(self, sellerSKU, **kwargs) -> ApiResponse
|
|
68
|
+
|
|
69
|
+
Enrolls the item indicated by the specified seller SKU in the Small and Light program in the specified marketplace. If the item is not eligible, the ineligibility reasons are returned.
|
|
70
|
+
|
|
71
|
+
**Usage Plan:**
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
====================================== ==============
|
|
75
|
+
Rate (requests per second) Burst
|
|
76
|
+
====================================== ==============
|
|
77
|
+
2 5
|
|
78
|
+
====================================== ==============
|
|
79
|
+
|
|
80
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
seller_sku:string | * REQUIRED The seller SKU that identifies the item.
|
|
84
|
+
key marketplaceIds:array | * REQUIRED The marketplace in which to enroll the item. Note: Accepts a single marketplace only.
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
ApiResponse:
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
return await self._request(
|
|
91
|
+
fill_query_params(kwargs.pop("path"), seller_sku),
|
|
92
|
+
params={
|
|
93
|
+
"marketplaceIds": kwargs.get("marketplaceIds", self.marketplace_id)
|
|
94
|
+
},
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
@deprecated
|
|
98
|
+
async def delete_small_and_light_enrollment_by_seller_s_k_u(
|
|
99
|
+
self, sellerSKU, **kwargs
|
|
100
|
+
) -> ApiResponse:
|
|
101
|
+
return await self.delete_small_and_light_enrollment_by_seller_sku(
|
|
102
|
+
sellerSKU, **kwargs
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
@sp_endpoint("/fba/smallAndLight/v1/enrollments/{}", method="DELETE")
|
|
106
|
+
async def delete_small_and_light_enrollment_by_seller_sku(
|
|
107
|
+
self, seller_sku, **kwargs
|
|
108
|
+
) -> ApiResponse:
|
|
109
|
+
"""
|
|
110
|
+
delete_small_and_light_enrollment_by_seller_s_k_u(self, sellerSKU, **kwargs) -> ApiResponse
|
|
111
|
+
|
|
112
|
+
Removes the item indicated by the specified seller SKU from the Small and Light program in the specified marketplace. If the item is not eligible for disenrollment, the ineligibility reasons are returned.
|
|
113
|
+
|
|
114
|
+
**Usage Plan:**
|
|
115
|
+
|
|
116
|
+
====================================== ==============
|
|
117
|
+
Rate (requests per second) Burst
|
|
118
|
+
====================================== ==============
|
|
119
|
+
2 5
|
|
120
|
+
====================================== ==============
|
|
121
|
+
|
|
122
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
123
|
+
|
|
124
|
+
Args:
|
|
125
|
+
seller_sku:string | * REQUIRED The seller SKU that identifies the item.
|
|
126
|
+
key marketplaceIds:array | * REQUIRED The marketplace in which to remove the item from the Small and Light program. Note: Accepts a single marketplace only.
|
|
127
|
+
|
|
128
|
+
Returns:
|
|
129
|
+
ApiResponse:
|
|
130
|
+
"""
|
|
131
|
+
|
|
132
|
+
return await self._request(
|
|
133
|
+
fill_query_params(kwargs.pop("path"), seller_sku), data=kwargs
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
@deprecated
|
|
137
|
+
async def get_small_and_light_eligibility_by_seller_s_k_u(
|
|
138
|
+
self, sellerSKU, **kwargs
|
|
139
|
+
) -> ApiResponse:
|
|
140
|
+
return await self.get_small_and_light_eligibility_by_seller_sku(
|
|
141
|
+
sellerSKU, **kwargs
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
@sp_endpoint("/fba/smallAndLight/v1/eligibilities/{}", method="GET")
|
|
145
|
+
async def get_small_and_light_eligibility_by_seller_sku(
|
|
146
|
+
self, seller_sku, **kwargs
|
|
147
|
+
) -> ApiResponse:
|
|
148
|
+
"""
|
|
149
|
+
get_small_and_light_eligibility_by_seller_s_k_u(self, sellerSKU, **kwargs) -> ApiResponse
|
|
150
|
+
|
|
151
|
+
Returns the Small and Light program eligibility status of the item indicated by the specified seller SKU in the specified marketplace. If the item is not eligible, the ineligibility reasons are returned.
|
|
152
|
+
|
|
153
|
+
**Usage Plan:**
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
====================================== ==============
|
|
157
|
+
Rate (requests per second) Burst
|
|
158
|
+
====================================== ==============
|
|
159
|
+
2 10
|
|
160
|
+
====================================== ==============
|
|
161
|
+
|
|
162
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
163
|
+
|
|
164
|
+
Args:
|
|
165
|
+
seller_sku:string | * REQUIRED The seller SKU that identifies the item.
|
|
166
|
+
key marketplaceIds:array | * REQUIRED The marketplace for which the eligibility status is retrieved. NOTE: Accepts a single marketplace only.
|
|
167
|
+
|
|
168
|
+
Returns:
|
|
169
|
+
ApiResponse:
|
|
170
|
+
"""
|
|
171
|
+
|
|
172
|
+
return await self._request(
|
|
173
|
+
fill_query_params(kwargs.pop("path"), seller_sku), params=kwargs
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
@sp_endpoint("/fba/smallAndLight/v1/feePreviews", method="POST")
|
|
177
|
+
async def get_small_and_light_fee_preview(self, **kwargs) -> ApiResponse:
|
|
178
|
+
"""
|
|
179
|
+
get_small_and_light_fee_preview(self, **kwargs) -> ApiResponse
|
|
180
|
+
|
|
181
|
+
Returns the Small and Light fee estimates for the specified items. You must include a marketplaceId parameter to retrieve the proper fee estimates for items to be sold in that marketplace. The ordering of items in the response will mirror the order of the items in the request. Duplicate ASIN/price combinations are removed.
|
|
182
|
+
|
|
183
|
+
**Usage Plan:**
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
====================================== ==============
|
|
187
|
+
Rate (requests per second) Burst
|
|
188
|
+
====================================== ==============
|
|
189
|
+
1 3
|
|
190
|
+
====================================== ==============
|
|
191
|
+
|
|
192
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
193
|
+
|
|
194
|
+
Args:
|
|
195
|
+
body: REQUIRED
|
|
196
|
+
{
|
|
197
|
+
"marketplaceId": "string",
|
|
198
|
+
"items": [
|
|
199
|
+
{
|
|
200
|
+
"asin": "string",
|
|
201
|
+
"price": {
|
|
202
|
+
"currencyCode": "string",
|
|
203
|
+
"amount": 0
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
Returns:
|
|
210
|
+
ApiResponse:
|
|
211
|
+
"""
|
|
212
|
+
|
|
213
|
+
return await self._request(kwargs.pop("path"), data=kwargs)
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import zlib
|
|
2
|
+
|
|
3
|
+
from sp_api.base import Client, sp_endpoint, fill_query_params, ApiResponse
|
|
4
|
+
from sp_api.asyncio.base import AsyncBaseClient
|
|
5
|
+
from sp_api.util import should_add_marketplace
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Feeds(AsyncBaseClient):
|
|
9
|
+
"""
|
|
10
|
+
Feeds SP-API Client
|
|
11
|
+
:link:
|
|
12
|
+
|
|
13
|
+
The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
@sp_endpoint("/feeds/2021-06-30/feeds", method="GET")
|
|
17
|
+
async def get_feeds(self, **kwargs) -> ApiResponse:
|
|
18
|
+
"""
|
|
19
|
+
get_feeds(self, **kwargs) -> ApiResponse
|
|
20
|
+
|
|
21
|
+
Returns feed details for the feeds that match the filters that you specify.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
key feedTypes:array | A list of feed types used to filter feeds. When feedTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also be provided. Either feedTypes or nextToken is required.
|
|
25
|
+
key marketplaceIds:array | A list of marketplace identifiers used to filter feeds. The feeds returned will match at least one of the marketplaces that you specify.
|
|
26
|
+
key pageSize:integer | The maximum number of feeds to return in a single call.
|
|
27
|
+
key processingStatuses:array | A list of processing statuses used to filter feeds.
|
|
28
|
+
key createdSince:string | The earliest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is 90 days ago. Feeds are retained for a maximum of 90 days.
|
|
29
|
+
key createdUntil:string | The latest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is now.
|
|
30
|
+
key nextToken:string | A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getFeeds operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
ApiResponse:
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
add_marketplace = should_add_marketplace(kwargs, "nextToken")
|
|
38
|
+
return await self._request(
|
|
39
|
+
kwargs.pop("path"), params=kwargs, add_marketplace=add_marketplace
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
async def submit_feed(
|
|
43
|
+
self, feed_type, file, content_type="text/tsv", **kwargs
|
|
44
|
+
) -> [ApiResponse, ApiResponse]:
|
|
45
|
+
"""
|
|
46
|
+
submit_feed(self, feed_type: str, file: File or File like, content_type='text/tsv', **kwargs) -> [ApiResponse, ApiResponse]
|
|
47
|
+
Combines `create_feed_document` and `create_feed`, uploads the file and sends the feed to amazon.
|
|
48
|
+
|
|
49
|
+
**Usage Plan:**
|
|
50
|
+
|
|
51
|
+
====================================== ==============
|
|
52
|
+
Rate (requests per second) Burst
|
|
53
|
+
====================================== ==============
|
|
54
|
+
0.0083 15
|
|
55
|
+
====================================== ==============
|
|
56
|
+
|
|
57
|
+
Examples:
|
|
58
|
+
literal blocks::
|
|
59
|
+
|
|
60
|
+
feed = BytesIO
|
|
61
|
+
feed.write(<your feed>)
|
|
62
|
+
feed.seek(0)
|
|
63
|
+
Feeds().submit_feed('POST_FBA_INBOUND_CARTON_CONTENTS', feed, 'text/xml')
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
feed_type:
|
|
68
|
+
file:
|
|
69
|
+
content_type:
|
|
70
|
+
**kwargs:
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
[ApiResponse:, ApiResponse:]
|
|
74
|
+
"""
|
|
75
|
+
document_response = await self.create_feed_document(file, content_type)
|
|
76
|
+
return document_response, await self.create_feed(
|
|
77
|
+
feed_type, document_response.payload.get("feedDocumentId"), **kwargs
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
@sp_endpoint("/feeds/2021-06-30/feeds", method="POST")
|
|
81
|
+
async def create_feed(self, feed_type, input_feed_document_id, **kwargs) -> ApiResponse:
|
|
82
|
+
"""
|
|
83
|
+
create_feed(self, feed_type: str, input_feed_document_id: str, **kwargs) -> ApiResponse
|
|
84
|
+
|
|
85
|
+
Creates a feed. Call `create_feed_document` to upload the feed first.
|
|
86
|
+
`submit_feed` combines both.
|
|
87
|
+
|
|
88
|
+
**Usage Plan:**
|
|
89
|
+
|
|
90
|
+
====================================== ==============
|
|
91
|
+
Rate (requests per second) Burst
|
|
92
|
+
====================================== ==============
|
|
93
|
+
0.0083 15
|
|
94
|
+
====================================== ==============
|
|
95
|
+
|
|
96
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
97
|
+
|
|
98
|
+
Examples:
|
|
99
|
+
literal blocks::
|
|
100
|
+
|
|
101
|
+
Feeds().create_feed('POST_PRODUCT_DATA', '3d4e42b5-1d6e-44e8-a89c-2abfca0625bb',
|
|
102
|
+
marketplaceIds=["ATVPDKIKX0DER", "A1F83G8C2ARO7P"])
|
|
103
|
+
|
|
104
|
+
Args:
|
|
105
|
+
feed_type: https://github.com/amzn/selling-partner-api-docs/blob/main/references/feeds-api/feedtype-values.md
|
|
106
|
+
input_feed_document_id: str
|
|
107
|
+
**kwargs:
|
|
108
|
+
|
|
109
|
+
Returns:
|
|
110
|
+
ApiResponse:
|
|
111
|
+
"""
|
|
112
|
+
data = {
|
|
113
|
+
"feedType": feed_type,
|
|
114
|
+
"inputFeedDocumentId": input_feed_document_id,
|
|
115
|
+
**kwargs,
|
|
116
|
+
}
|
|
117
|
+
return await self._request(kwargs.pop("path"), data=data)
|
|
118
|
+
|
|
119
|
+
@sp_endpoint("/feeds/2021-06-30/feeds/{}", method="DELETE")
|
|
120
|
+
async def cancel_feed(self, feedId, **kwargs) -> ApiResponse:
|
|
121
|
+
"""
|
|
122
|
+
cancel_feed(self, feedId, **kwargs) -> ApiResponse
|
|
123
|
+
|
|
124
|
+
Cancels the feed that you specify. Only feeds with processingStatus=IN_QUEUE can be cancelled. Cancelled feeds are returned in subsequent calls to the getFeed and getFeeds operations.
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
|
|
128
|
+
feedId:string | * REQUIRED The identifier for the feed. This identifier is unique only in combination with a seller ID.
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
Returns:
|
|
132
|
+
ApiResponse:
|
|
133
|
+
"""
|
|
134
|
+
|
|
135
|
+
return await self._request(fill_query_params(kwargs.pop("path"), feedId), data=kwargs)
|
|
136
|
+
|
|
137
|
+
@sp_endpoint("/feeds/2021-06-30/feeds/{}", method="GET")
|
|
138
|
+
async def get_feed(self, feedId, **kwargs) -> ApiResponse:
|
|
139
|
+
"""
|
|
140
|
+
get_feed(self, feedId, **kwargs) -> ApiResponse
|
|
141
|
+
|
|
142
|
+
Returns feed details (including the resultDocumentId, if available) for the feed that you specify.
|
|
143
|
+
|
|
144
|
+
Args:
|
|
145
|
+
|
|
146
|
+
feedId:string | * REQUIRED The identifier for the feed. This identifier is unique only in combination with a seller ID.
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
ApiResponse:
|
|
151
|
+
"""
|
|
152
|
+
|
|
153
|
+
return await self._request(
|
|
154
|
+
fill_query_params(kwargs.pop("path"), feedId),
|
|
155
|
+
params=kwargs,
|
|
156
|
+
add_marketplace=False,
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
@sp_endpoint("/feeds/2021-06-30/documents", method="POST")
|
|
160
|
+
async def create_feed_document(self, file, content_type, **kwargs) -> ApiResponse:
|
|
161
|
+
"""
|
|
162
|
+
create_feed_document(self, **kwargs) -> ApiResponse
|
|
163
|
+
|
|
164
|
+
Creates a feed document for the feed type that you specify. This operation returns a presigned URL for uploading the feed document contents. It also returns a feedDocumentId value that you can pass in with a subsequent call to the createFeed operation.
|
|
165
|
+
|
|
166
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
167
|
+
|
|
168
|
+
Args:
|
|
169
|
+
file: File or File like object. Setting this to None will skip the upload.
|
|
170
|
+
content_type: str
|
|
171
|
+
body: | * REQUIRED {'description': 'Specifies the content type for the createFeedDocument operation.', 'properties': {'contentType': {'description': 'The content type of the feed.', 'type': 'string'}}, 'required': ['contentType'], 'type': 'object'}
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
Returns:
|
|
175
|
+
ApiResponse:
|
|
176
|
+
"""
|
|
177
|
+
data = {"contentType": kwargs.get("contentType", content_type)}
|
|
178
|
+
response = await self._request(kwargs.get("path"), data={**data, **kwargs})
|
|
179
|
+
|
|
180
|
+
if file is None:
|
|
181
|
+
return response
|
|
182
|
+
|
|
183
|
+
upload_data = file.read()
|
|
184
|
+
try:
|
|
185
|
+
upload_data = upload_data.encode("iso-8859-1")
|
|
186
|
+
except AttributeError:
|
|
187
|
+
pass
|
|
188
|
+
upload = await self._transport.request(
|
|
189
|
+
"PUT",
|
|
190
|
+
response.payload.get("url"),
|
|
191
|
+
content=upload_data,
|
|
192
|
+
headers={"Content-Type": content_type},
|
|
193
|
+
)
|
|
194
|
+
if 200 <= upload.status_code < 300:
|
|
195
|
+
return response
|
|
196
|
+
from sp_api.base.exceptions import SellingApiException
|
|
197
|
+
|
|
198
|
+
raise SellingApiException(
|
|
199
|
+
headers=upload.headers, error=upload.json().get("errors")
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
@sp_endpoint("/feeds/2021-06-30/documents/{}", method="GET")
|
|
203
|
+
async def get_feed_document(self, feedDocumentId, **kwargs) -> str:
|
|
204
|
+
"""
|
|
205
|
+
get_feed_document(self, feedDocumentId, **kwargs) -> ApiResponse
|
|
206
|
+
|
|
207
|
+
Returns the information required for retrieving a feed document's contents.
|
|
208
|
+
|
|
209
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
210
|
+
|
|
211
|
+
Args:
|
|
212
|
+
|
|
213
|
+
feedDocumentId:string | * REQUIRED The identifier of the feed document.
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
Returns:
|
|
217
|
+
ApiResponse:
|
|
218
|
+
"""
|
|
219
|
+
|
|
220
|
+
return await self.get_feed_result_document(feedDocumentId)
|
|
221
|
+
|
|
222
|
+
@sp_endpoint("/feeds/2021-06-30/documents/{}", method="GET")
|
|
223
|
+
async def get_feed_result_document(self, feedDocumentId, **kwargs) -> str:
|
|
224
|
+
"""
|
|
225
|
+
get_feed_result_document(self, feedDocumentId, **kwargs) -> str
|
|
226
|
+
|
|
227
|
+
Returns the feed result document's contents. First fetches from `getFeedDocument` endpont and then fetchs from the URL returned from it.
|
|
228
|
+
|
|
229
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
230
|
+
|
|
231
|
+
Args:
|
|
232
|
+
feedDocumentId: str
|
|
233
|
+
**kwargs:
|
|
234
|
+
|
|
235
|
+
Returns:
|
|
236
|
+
str:
|
|
237
|
+
"""
|
|
238
|
+
response = await self._request(
|
|
239
|
+
fill_query_params(kwargs.pop("path"), feedDocumentId),
|
|
240
|
+
params=kwargs,
|
|
241
|
+
add_marketplace=False,
|
|
242
|
+
)
|
|
243
|
+
url = response.payload.get("url")
|
|
244
|
+
doc_response = await self._transport.request("GET", url)
|
|
245
|
+
|
|
246
|
+
encoding = (
|
|
247
|
+
doc_response.encoding
|
|
248
|
+
if doc_response and doc_response.encoding
|
|
249
|
+
else "iso-8859-1"
|
|
250
|
+
)
|
|
251
|
+
if encoding.lower() == "windows-31j":
|
|
252
|
+
encoding = "cp932"
|
|
253
|
+
|
|
254
|
+
content = doc_response.content
|
|
255
|
+
if "compressionAlgorithm" in response.payload:
|
|
256
|
+
try:
|
|
257
|
+
return zlib.decompress(bytearray(content), 15 + 32).decode(encoding)
|
|
258
|
+
except Exception:
|
|
259
|
+
return content.decode(encoding)
|
|
260
|
+
return content.decode(encoding)
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import enum
|
|
2
|
+
|
|
3
|
+
from sp_api.base import Client, Marketplaces, ApiResponse
|
|
4
|
+
from sp_api.asyncio.base import AsyncBaseClient
|
|
5
|
+
from sp_api.base import sp_endpoint, fill_query_params
|
|
6
|
+
|
|
7
|
+
class FinancesVersion(str, enum.Enum):
|
|
8
|
+
V_0 = "v0"
|
|
9
|
+
V_2024_06_19 = "2024-06-19"
|
|
10
|
+
LATEST = "2024-06-19"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Finances(AsyncBaseClient):
|
|
14
|
+
version: FinancesVersion = FinancesVersion.V_0
|
|
15
|
+
|
|
16
|
+
def __init__(self, *args, **kwargs):
|
|
17
|
+
if "version" in kwargs:
|
|
18
|
+
self.version = kwargs.get("version", FinancesVersion.V_0)
|
|
19
|
+
super().__init__(*args, **{**kwargs, "version": self.version})
|
|
20
|
+
|
|
21
|
+
@sp_endpoint("/finances/<version>/orders/{}/financialEvents")
|
|
22
|
+
async def get_financial_events_for_order(self, order_id, **kwargs) -> ApiResponse:
|
|
23
|
+
"""
|
|
24
|
+
get_financial_events_for_order(self, order_id, **kwargs) -> ApiResponse
|
|
25
|
+
|
|
26
|
+
Examples:
|
|
27
|
+
literal blocks::
|
|
28
|
+
|
|
29
|
+
Finances().get_financial_events_for_order('485-734-5434857', MaxResultsPerPage=10)
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
order_id:
|
|
33
|
+
**kwargs:
|
|
34
|
+
|
|
35
|
+
Returns:
|
|
36
|
+
|
|
37
|
+
"""
|
|
38
|
+
return await self._request(
|
|
39
|
+
fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
@sp_endpoint("/finances/<version>/financialEvents")
|
|
43
|
+
async def list_financial_events(self, **kwargs) -> ApiResponse:
|
|
44
|
+
"""
|
|
45
|
+
list_financial_events(self, **kwargs) -> ApiResponse:
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
**kwargs:
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
|
|
53
|
+
"""
|
|
54
|
+
return await self._request(fill_query_params(kwargs.pop("path")), params={**kwargs})
|
|
55
|
+
|
|
56
|
+
@sp_endpoint("/finances/<version>/financialEventGroups/{}/financialEvents")
|
|
57
|
+
async def list_financial_events_by_group_id(
|
|
58
|
+
self, event_group_id, **kwargs
|
|
59
|
+
) -> ApiResponse:
|
|
60
|
+
"""
|
|
61
|
+
list_financial_events_by_groupid(self, event_group_id, **kwargs) -> ApiResponse:
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
event_group_id
|
|
66
|
+
**kwargs:
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
|
|
70
|
+
"""
|
|
71
|
+
return await self._request(
|
|
72
|
+
fill_query_params(kwargs.pop("path"), event_group_id), params={**kwargs}
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
@sp_endpoint("/finances/<version>/financialEventGroups")
|
|
76
|
+
async def list_financial_event_groups(self, **kwargs) -> ApiResponse:
|
|
77
|
+
"""
|
|
78
|
+
list_financial_event_groups(self, **kwargs) -> ApiResponse:
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
**kwargs:
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
|
|
86
|
+
"""
|
|
87
|
+
return await self._request(kwargs.pop("path"), params={**kwargs})
|
|
88
|
+
|
|
89
|
+
@sp_endpoint("/finances/<version>/transactions")
|
|
90
|
+
async def list_transactions(self, **kwargs) -> ApiResponse:
|
|
91
|
+
"""
|
|
92
|
+
list_transactions(self, **kwargs) -> ApiResponse:
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
**kwargs:
|
|
96
|
+
|
|
97
|
+
Returns: ApiResponse
|
|
98
|
+
"""
|
|
99
|
+
|
|
100
|
+
return await self._request(kwargs.pop("path"), params={**kwargs})
|