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.
- {python_amazon_sp_api-1.7.5.data → python_amazon_sp_api-2.0.10.data}/scripts/make_endpoint +2 -2
- {python_amazon_sp_api-1.7.5.dist-info → python_amazon_sp_api-2.0.10.dist-info}/METADATA +58 -8
- python_amazon_sp_api-2.0.10.dist-info/RECORD +253 -0
- {python_amazon_sp_api-1.7.5.dist-info → python_amazon_sp_api-2.0.10.dist-info}/WHEEL +1 -1
- {python_amazon_sp_api-1.7.5.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 +48 -41
- sp_api/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +82 -76
- sp_api/api/aplus_content/aplus_content.py +76 -45
- sp_api/api/application_integrations/application_integrations.py +118 -0
- sp_api/api/application_management/application_management.py +6 -7
- sp_api/api/authorization/authorization.py +5 -5
- sp_api/api/catalog/catalog.py +9 -10
- sp_api/api/catalog_items/catalog_items.py +10 -13
- sp_api/api/customer_feedback/customer_feedback.py +110 -0
- sp_api/api/data_kiosk/data_kiosk.py +59 -39
- sp_api/api/easy_ship/easy_ship.py +190 -0
- sp_api/api/external_fulfillment/external_fulfillment.py +706 -0
- sp_api/api/fba_inbound_eligibility/fba_inbound_eligibility.py +23 -13
- sp_api/api/fba_small_and_light/fba_small_and_light.py +46 -20
- sp_api/api/feeds/feeds.py +60 -39
- sp_api/api/finances/finances.py +40 -9
- sp_api/api/fulfillment_inbound/fulfillment_inbound.py +844 -619
- sp_api/api/fulfillment_outbound/fulfillment_outbound.py +63 -57
- sp_api/api/inventories/inventories.py +13 -11
- sp_api/api/listings_items/listings_items.py +38 -25
- sp_api/api/listings_restrictions/listings_restrictions.py +6 -7
- sp_api/api/merchant_fulfillment/merchant_fulfillment.py +49 -36
- sp_api/api/messaging/messaging.py +129 -25
- sp_api/api/notifications/notifications.py +85 -45
- sp_api/api/orders/orders.py +123 -38
- sp_api/api/orders/orders_2026_01_01.py +54 -0
- sp_api/api/product_fees/product_fees.py +75 -67
- sp_api/api/product_type_definitions/product_type_definitions.py +9 -10
- sp_api/api/products/products.py +177 -53
- sp_api/api/products/products_definitions.py +11 -82
- sp_api/api/replenishment/replenishment.py +13 -11
- sp_api/api/reports/reports.py +113 -95
- sp_api/api/sales/sales.py +23 -13
- sp_api/api/sellers/sellers.py +3 -3
- sp_api/api/services/services.py +41 -30
- sp_api/api/shipping/shipping.py +39 -37
- sp_api/api/shipping/shippingV2.py +46 -30
- sp_api/api/solicitations/solicitations.py +20 -11
- sp_api/api/supply_sources/supply_sources.py +45 -37
- sp_api/api/tokens/tokens.py +4 -6
- sp_api/api/upload/upload.py +10 -8
- sp_api/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +10 -6
- sp_api/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +12 -14
- sp_api/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +4 -6
- sp_api/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +42 -37
- sp_api/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +8 -6
- sp_api/api/vendor_invoices/vendor_invoices.py +6 -4
- sp_api/api/vendor_orders/vendor_orders.py +16 -19
- sp_api/api/vendor_shipments/vendor_shipments.py +91 -262
- sp_api/api/vendor_transaction_status/vendor_transaction_status.py +6 -6
- 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/__init__.py +0 -0
- sp_api/asyncio/api/listings_items/listings_items.py +170 -0
- sp_api/asyncio/api/listings_restrictions/__init__.py +0 -0
- sp_api/asyncio/api/listings_restrictions/listings_restrictions.py +36 -0
- sp_api/asyncio/api/merchant_fulfillment/__init__.py +0 -0
- sp_api/asyncio/api/merchant_fulfillment/merchant_fulfillment.py +384 -0
- sp_api/asyncio/api/messaging/__init__.py +0 -0
- sp_api/asyncio/api/messaging/messaging.py +511 -0
- sp_api/asyncio/api/models/__init__.py +4 -0
- sp_api/asyncio/api/notifications/__init__.py +0 -0
- sp_api/asyncio/api/notifications/notifications.py +295 -0
- sp_api/asyncio/api/orders/__init__.py +0 -0
- sp_api/asyncio/api/orders/orders.py +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/__init__.py +3 -3
- sp_api/auth/_core.py +39 -0
- sp_api/auth/access_token_client.py +20 -31
- sp_api/auth/access_token_response.py +4 -4
- sp_api/base/ApiResponse.py +5 -4
- sp_api/base/__init__.py +53 -42
- sp_api/base/_core.py +110 -0
- sp_api/base/_transport_httpx.py +39 -0
- sp_api/base/base_client.py +4 -4
- sp_api/base/client.py +131 -112
- sp_api/base/credential_provider.py +41 -34
- sp_api/base/exceptions.py +14 -3
- sp_api/base/feedTypes.py +44 -32
- sp_api/base/fulfillment_channel.py +2 -2
- sp_api/base/helpers.py +17 -16
- sp_api/base/identifiersType.py +8 -8
- sp_api/base/included_data.py +12 -12
- sp_api/base/marketplaces.py +5 -1
- sp_api/base/notifications.py +1 -1
- sp_api/base/processing_status.py +5 -5
- sp_api/base/reportTypes.py +198 -111
- sp_api/base/sales_enum.py +11 -13
- sp_api/util/__init__.py +42 -6
- sp_api/util/key_maker.py +4 -2
- sp_api/util/load_all_pages.py +16 -5
- sp_api/util/load_date_bound.py +28 -13
- 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
- sp_api/util/retry.py +16 -15
- python_amazon_sp_api-1.7.5.dist-info/RECORD +0 -144
- 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.7.5.dist-info → python_amazon_sp_api-2.0.10.dist-info/licenses}/LICENSE +0 -0
- {tests → sp_api/api/application_integrations}/__init__.py +0 -0
- {tests/api → sp_api/api/customer_feedback}/__init__.py +0 -0
- {tests/api/finances → sp_api/api/easy_ship}/__init__.py +0 -0
- {tests/api/notifications → sp_api/api/external_fulfillment}/__init__.py +0 -0
- {tests/api/orders → sp_api/asyncio}/__init__.py +0 -0
- {tests/api/product_fees → sp_api/asyncio/api/feeds}/__init__.py +0 -0
- {tests/api/reports → sp_api/asyncio/api/finances}/__init__.py +0 -0
- {tests/api/sellers → sp_api/asyncio/api/fulfillment_inbound}/__init__.py +0 -0
- {tests/client → sp_api/asyncio/api/fulfillment_outbound}/__init__.py +0 -0
- /tests/api/sellers/test_sellers.py → /sp_api/asyncio/api/inventories/__init__.py +0 -0
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import urllib.parse
|
|
2
2
|
|
|
3
|
-
from sp_api.base import
|
|
3
|
+
from sp_api.base import (
|
|
4
|
+
Client,
|
|
5
|
+
sp_endpoint,
|
|
6
|
+
fill_query_params,
|
|
7
|
+
IneligibilityReasonList,
|
|
8
|
+
ApiResponse,
|
|
9
|
+
)
|
|
4
10
|
|
|
5
11
|
|
|
6
12
|
class FbaInboundEligibility(Client):
|
|
7
13
|
"""
|
|
8
14
|
FbaInboundEligibility SP-API Client
|
|
9
|
-
:link:
|
|
15
|
+
:link:
|
|
10
16
|
|
|
11
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.
|
|
12
18
|
"""
|
|
13
19
|
|
|
14
|
-
|
|
15
|
-
@sp_endpoint('/fba/inbound/v1/eligibility/itemPreview', method='GET')
|
|
20
|
+
@sp_endpoint("/fba/inbound/v1/eligibility/itemPreview", method="GET")
|
|
16
21
|
def get_item_eligibility_preview(self, **kwargs) -> ApiResponse:
|
|
17
22
|
"""
|
|
18
23
|
get_item_eligibility_preview(self, **kwargs) -> ApiResponse
|
|
@@ -34,14 +39,14 @@ class FbaInboundEligibility(Client):
|
|
|
34
39
|
key marketplaceIds:array | The identifier for the marketplace in which you want to determine eligibility. Required only when program=INBOUND.
|
|
35
40
|
key asin:string | * REQUIRED The ASIN of the item for which you want an eligibility preview.
|
|
36
41
|
key program:string | * REQUIRED The program that you want to check eligibility against.
|
|
37
|
-
|
|
42
|
+
|
|
38
43
|
|
|
39
44
|
Returns:
|
|
40
45
|
ApiResponse:
|
|
41
46
|
"""
|
|
42
|
-
return self._request(kwargs.pop(
|
|
47
|
+
return self._request(kwargs.pop("path"), params=kwargs)
|
|
43
48
|
|
|
44
|
-
@sp_endpoint(
|
|
49
|
+
@sp_endpoint("/fba/inbound/v1/eligibility/itemPreview", method="GET")
|
|
45
50
|
def get_item_eligibility_preview_extended(self, **kwargs) -> ApiResponse:
|
|
46
51
|
"""
|
|
47
52
|
get_item_eligibility_preview_extended(self, **kwargs) -> ApiResponse
|
|
@@ -69,18 +74,23 @@ class FbaInboundEligibility(Client):
|
|
|
69
74
|
ApiResponse:
|
|
70
75
|
"""
|
|
71
76
|
|
|
72
|
-
api_response = self._request(kwargs.pop(
|
|
77
|
+
api_response = self._request(kwargs.pop("path"), params=kwargs)
|
|
73
78
|
|
|
74
|
-
if
|
|
79
|
+
if (
|
|
80
|
+
api_response.payload.get("ineligibilityReasonList")
|
|
81
|
+
and api_response.payload.get("isEligibleForProgram") is False
|
|
82
|
+
):
|
|
75
83
|
ineligibility_list = api_response.payload.get("ineligibilityReasonList")
|
|
76
84
|
errors = []
|
|
77
85
|
for ineligibility_option in ineligibility_list:
|
|
78
86
|
try:
|
|
79
|
-
errors.append(
|
|
87
|
+
errors.append(
|
|
88
|
+
ineligibility_option
|
|
89
|
+
+ ": "
|
|
90
|
+
+ IneligibilityReasonList[ineligibility_option].value
|
|
91
|
+
)
|
|
80
92
|
except KeyError as error:
|
|
81
93
|
errors.append(error)
|
|
82
|
-
api_response.payload.update({
|
|
83
|
-
"ineligibilityReasonListMessage": errors
|
|
84
|
-
})
|
|
94
|
+
api_response.payload.update({"ineligibilityReasonListMessage": errors})
|
|
85
95
|
|
|
86
96
|
return api_response
|
|
@@ -6,17 +6,21 @@ from sp_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, dep
|
|
|
6
6
|
class FbaSmallAndLight(Client):
|
|
7
7
|
"""
|
|
8
8
|
FbaSmallAndLight SP-API Client
|
|
9
|
-
:link:
|
|
9
|
+
:link:
|
|
10
10
|
|
|
11
11
|
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.
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
14
|
@deprecated
|
|
15
|
-
def get_small_and_light_enrollment_by_seller_s_k_u(
|
|
15
|
+
def get_small_and_light_enrollment_by_seller_s_k_u(
|
|
16
|
+
self, sellerSKU, **kwargs
|
|
17
|
+
) -> ApiResponse:
|
|
16
18
|
return self.get_small_and_light_enrollment_by_seller_sku(sellerSKU, **kwargs)
|
|
17
19
|
|
|
18
|
-
@sp_endpoint(
|
|
19
|
-
def get_small_and_light_enrollment_by_seller_sku(
|
|
20
|
+
@sp_endpoint("/fba/smallAndLight/v1/enrollments/{}", method="GET")
|
|
21
|
+
def get_small_and_light_enrollment_by_seller_sku(
|
|
22
|
+
self, seller_sku, **kwargs
|
|
23
|
+
) -> ApiResponse:
|
|
20
24
|
"""
|
|
21
25
|
get_small_and_light_enrollment_by_seller_s_k_u(self, sellerSKU, **kwargs) -> ApiResponse
|
|
22
26
|
|
|
@@ -40,14 +44,20 @@ class FbaSmallAndLight(Client):
|
|
|
40
44
|
ApiResponse:
|
|
41
45
|
"""
|
|
42
46
|
|
|
43
|
-
return self._request(
|
|
47
|
+
return self._request(
|
|
48
|
+
fill_query_params(kwargs.pop("path"), seller_sku), params=kwargs
|
|
49
|
+
)
|
|
44
50
|
|
|
45
51
|
@deprecated
|
|
46
|
-
def put_small_and_light_enrollment_by_seller_s_k_u(
|
|
52
|
+
def put_small_and_light_enrollment_by_seller_s_k_u(
|
|
53
|
+
self, sellerSKU, **kwargs
|
|
54
|
+
) -> ApiResponse:
|
|
47
55
|
return self.put_small_and_light_enrollment_by_seller_sku(sellerSKU, **kwargs)
|
|
48
56
|
|
|
49
|
-
@sp_endpoint(
|
|
50
|
-
def put_small_and_light_enrollment_by_seller_sku(
|
|
57
|
+
@sp_endpoint("/fba/smallAndLight/v1/enrollments/{}", method="PUT")
|
|
58
|
+
def put_small_and_light_enrollment_by_seller_sku(
|
|
59
|
+
self, seller_sku, **kwargs
|
|
60
|
+
) -> ApiResponse:
|
|
51
61
|
"""
|
|
52
62
|
put_small_and_light_enrollment_by_seller_s_k_u(self, sellerSKU, **kwargs) -> ApiResponse
|
|
53
63
|
|
|
@@ -72,15 +82,23 @@ class FbaSmallAndLight(Client):
|
|
|
72
82
|
ApiResponse:
|
|
73
83
|
"""
|
|
74
84
|
|
|
75
|
-
return self._request(
|
|
76
|
-
|
|
85
|
+
return self._request(
|
|
86
|
+
fill_query_params(kwargs.pop("path"), seller_sku),
|
|
87
|
+
params={
|
|
88
|
+
"marketplaceIds": kwargs.get("marketplaceIds", self.marketplace_id)
|
|
89
|
+
},
|
|
90
|
+
)
|
|
77
91
|
|
|
78
92
|
@deprecated
|
|
79
|
-
def delete_small_and_light_enrollment_by_seller_s_k_u(
|
|
93
|
+
def delete_small_and_light_enrollment_by_seller_s_k_u(
|
|
94
|
+
self, sellerSKU, **kwargs
|
|
95
|
+
) -> ApiResponse:
|
|
80
96
|
return self.delete_small_and_light_enrollment_by_seller_sku(sellerSKU, **kwargs)
|
|
81
97
|
|
|
82
|
-
@sp_endpoint(
|
|
83
|
-
def delete_small_and_light_enrollment_by_seller_sku(
|
|
98
|
+
@sp_endpoint("/fba/smallAndLight/v1/enrollments/{}", method="DELETE")
|
|
99
|
+
def delete_small_and_light_enrollment_by_seller_sku(
|
|
100
|
+
self, seller_sku, **kwargs
|
|
101
|
+
) -> ApiResponse:
|
|
84
102
|
"""
|
|
85
103
|
delete_small_and_light_enrollment_by_seller_s_k_u(self, sellerSKU, **kwargs) -> ApiResponse
|
|
86
104
|
|
|
@@ -104,14 +122,20 @@ class FbaSmallAndLight(Client):
|
|
|
104
122
|
ApiResponse:
|
|
105
123
|
"""
|
|
106
124
|
|
|
107
|
-
return self._request(
|
|
125
|
+
return self._request(
|
|
126
|
+
fill_query_params(kwargs.pop("path"), seller_sku), data=kwargs
|
|
127
|
+
)
|
|
108
128
|
|
|
109
129
|
@deprecated
|
|
110
|
-
def get_small_and_light_eligibility_by_seller_s_k_u(
|
|
130
|
+
def get_small_and_light_eligibility_by_seller_s_k_u(
|
|
131
|
+
self, sellerSKU, **kwargs
|
|
132
|
+
) -> ApiResponse:
|
|
111
133
|
return self.get_small_and_light_eligibility_by_seller_sku(sellerSKU, **kwargs)
|
|
112
134
|
|
|
113
|
-
@sp_endpoint(
|
|
114
|
-
def get_small_and_light_eligibility_by_seller_sku(
|
|
135
|
+
@sp_endpoint("/fba/smallAndLight/v1/eligibilities/{}", method="GET")
|
|
136
|
+
def get_small_and_light_eligibility_by_seller_sku(
|
|
137
|
+
self, seller_sku, **kwargs
|
|
138
|
+
) -> ApiResponse:
|
|
115
139
|
"""
|
|
116
140
|
get_small_and_light_eligibility_by_seller_s_k_u(self, sellerSKU, **kwargs) -> ApiResponse
|
|
117
141
|
|
|
@@ -136,9 +160,11 @@ class FbaSmallAndLight(Client):
|
|
|
136
160
|
ApiResponse:
|
|
137
161
|
"""
|
|
138
162
|
|
|
139
|
-
return self._request(
|
|
163
|
+
return self._request(
|
|
164
|
+
fill_query_params(kwargs.pop("path"), seller_sku), params=kwargs
|
|
165
|
+
)
|
|
140
166
|
|
|
141
|
-
@sp_endpoint(
|
|
167
|
+
@sp_endpoint("/fba/smallAndLight/v1/feePreviews", method="POST")
|
|
142
168
|
def get_small_and_light_fee_preview(self, **kwargs) -> ApiResponse:
|
|
143
169
|
"""
|
|
144
170
|
get_small_and_light_fee_preview(self, **kwargs) -> ApiResponse
|
|
@@ -175,4 +201,4 @@ class FbaSmallAndLight(Client):
|
|
|
175
201
|
ApiResponse:
|
|
176
202
|
"""
|
|
177
203
|
|
|
178
|
-
return self._request(kwargs.pop(
|
|
204
|
+
return self._request(kwargs.pop("path"), data=kwargs)
|
sp_api/api/feeds/feeds.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import zlib
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import httpx
|
|
4
4
|
|
|
5
5
|
from sp_api.base import Client, sp_endpoint, fill_query_params, ApiResponse
|
|
6
|
+
from sp_api.util import should_add_marketplace
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class Feeds(Client):
|
|
@@ -13,7 +14,7 @@ class Feeds(Client):
|
|
|
13
14
|
The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner.
|
|
14
15
|
"""
|
|
15
16
|
|
|
16
|
-
@sp_endpoint(
|
|
17
|
+
@sp_endpoint("/feeds/2021-06-30/feeds", method="GET")
|
|
17
18
|
def get_feeds(self, **kwargs) -> ApiResponse:
|
|
18
19
|
"""
|
|
19
20
|
get_feeds(self, **kwargs) -> ApiResponse
|
|
@@ -34,10 +35,14 @@ class Feeds(Client):
|
|
|
34
35
|
ApiResponse:
|
|
35
36
|
"""
|
|
36
37
|
|
|
37
|
-
add_marketplace =
|
|
38
|
-
return self._request(
|
|
38
|
+
add_marketplace = should_add_marketplace(kwargs, "nextToken")
|
|
39
|
+
return self._request(
|
|
40
|
+
kwargs.pop("path"), params=kwargs, add_marketplace=add_marketplace
|
|
41
|
+
)
|
|
39
42
|
|
|
40
|
-
def submit_feed(
|
|
43
|
+
def submit_feed(
|
|
44
|
+
self, feed_type, file, content_type="text/tsv", **kwargs
|
|
45
|
+
) -> [ApiResponse, ApiResponse]:
|
|
41
46
|
"""
|
|
42
47
|
submit_feed(self, feed_type: str, file: File or File like, content_type='text/tsv', **kwargs) -> [ApiResponse, ApiResponse]
|
|
43
48
|
Combines `create_feed_document` and `create_feed`, uploads the file and sends the feed to amazon.
|
|
@@ -69,9 +74,11 @@ class Feeds(Client):
|
|
|
69
74
|
[ApiResponse:, ApiResponse:]
|
|
70
75
|
"""
|
|
71
76
|
document_response = self.create_feed_document(file, content_type)
|
|
72
|
-
return document_response, self.create_feed(
|
|
77
|
+
return document_response, self.create_feed(
|
|
78
|
+
feed_type, document_response.payload.get("feedDocumentId"), **kwargs
|
|
79
|
+
)
|
|
73
80
|
|
|
74
|
-
@sp_endpoint(
|
|
81
|
+
@sp_endpoint("/feeds/2021-06-30/feeds", method="POST")
|
|
75
82
|
def create_feed(self, feed_type, input_feed_document_id, **kwargs) -> ApiResponse:
|
|
76
83
|
"""
|
|
77
84
|
create_feed(self, feed_type: str, input_feed_document_id: str, **kwargs) -> ApiResponse
|
|
@@ -104,13 +111,13 @@ class Feeds(Client):
|
|
|
104
111
|
ApiResponse:
|
|
105
112
|
"""
|
|
106
113
|
data = {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
**kwargs
|
|
114
|
+
"feedType": feed_type,
|
|
115
|
+
"inputFeedDocumentId": input_feed_document_id,
|
|
116
|
+
**kwargs,
|
|
110
117
|
}
|
|
111
|
-
return self._request(kwargs.pop(
|
|
118
|
+
return self._request(kwargs.pop("path"), data=data)
|
|
112
119
|
|
|
113
|
-
@sp_endpoint(
|
|
120
|
+
@sp_endpoint("/feeds/2021-06-30/feeds/{}", method="DELETE")
|
|
114
121
|
def cancel_feed(self, feedId, **kwargs) -> ApiResponse:
|
|
115
122
|
"""
|
|
116
123
|
cancel_feed(self, feedId, **kwargs) -> ApiResponse
|
|
@@ -126,9 +133,9 @@ class Feeds(Client):
|
|
|
126
133
|
ApiResponse:
|
|
127
134
|
"""
|
|
128
135
|
|
|
129
|
-
return self._request(fill_query_params(kwargs.pop(
|
|
136
|
+
return self._request(fill_query_params(kwargs.pop("path"), feedId), data=kwargs)
|
|
130
137
|
|
|
131
|
-
@sp_endpoint(
|
|
138
|
+
@sp_endpoint("/feeds/2021-06-30/feeds/{}", method="GET")
|
|
132
139
|
def get_feed(self, feedId, **kwargs) -> ApiResponse:
|
|
133
140
|
"""
|
|
134
141
|
get_feed(self, feedId, **kwargs) -> ApiResponse
|
|
@@ -144,9 +151,13 @@ class Feeds(Client):
|
|
|
144
151
|
ApiResponse:
|
|
145
152
|
"""
|
|
146
153
|
|
|
147
|
-
return self._request(
|
|
154
|
+
return self._request(
|
|
155
|
+
fill_query_params(kwargs.pop("path"), feedId),
|
|
156
|
+
params=kwargs,
|
|
157
|
+
add_marketplace=False,
|
|
158
|
+
)
|
|
148
159
|
|
|
149
|
-
@sp_endpoint(
|
|
160
|
+
@sp_endpoint("/feeds/2021-06-30/documents", method="POST")
|
|
150
161
|
def create_feed_document(self, file, content_type, **kwargs) -> ApiResponse:
|
|
151
162
|
"""
|
|
152
163
|
create_feed_document(self, **kwargs) -> ApiResponse
|
|
@@ -164,30 +175,32 @@ class Feeds(Client):
|
|
|
164
175
|
Returns:
|
|
165
176
|
ApiResponse:
|
|
166
177
|
"""
|
|
167
|
-
data = {
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
response = self._request(kwargs.get('path'), data={**data, **kwargs})
|
|
178
|
+
data = {"contentType": kwargs.get("contentType", content_type)}
|
|
179
|
+
response = self._request(kwargs.get("path"), data={**data, **kwargs})
|
|
171
180
|
|
|
172
|
-
if
|
|
181
|
+
if file is None:
|
|
173
182
|
return response
|
|
174
183
|
|
|
175
184
|
upload_data = file.read()
|
|
176
185
|
try:
|
|
177
|
-
upload_data = upload_data.encode(
|
|
186
|
+
upload_data = upload_data.encode("iso-8859-1")
|
|
178
187
|
except AttributeError:
|
|
179
188
|
pass
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
189
|
+
with httpx.Client() as client:
|
|
190
|
+
upload = client.put(
|
|
191
|
+
response.payload.get("url"),
|
|
192
|
+
content=upload_data,
|
|
193
|
+
headers={"Content-Type": content_type},
|
|
194
|
+
)
|
|
185
195
|
if 200 <= upload.status_code < 300:
|
|
186
196
|
return response
|
|
187
197
|
from sp_api.base.exceptions import SellingApiException
|
|
188
|
-
raise SellingApiException(headers=upload.headers, error=upload.json().get('errors'))
|
|
189
198
|
|
|
190
|
-
|
|
199
|
+
raise SellingApiException(
|
|
200
|
+
headers=upload.headers, error=upload.json().get("errors")
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
@sp_endpoint("/feeds/2021-06-30/documents/{}", method="GET")
|
|
191
204
|
def get_feed_document(self, feedDocumentId, **kwargs) -> str:
|
|
192
205
|
"""
|
|
193
206
|
get_feed_document(self, feedDocumentId, **kwargs) -> ApiResponse
|
|
@@ -207,7 +220,7 @@ class Feeds(Client):
|
|
|
207
220
|
|
|
208
221
|
return self.get_feed_result_document(feedDocumentId)
|
|
209
222
|
|
|
210
|
-
@sp_endpoint(
|
|
223
|
+
@sp_endpoint("/feeds/2021-06-30/documents/{}", method="GET")
|
|
211
224
|
def get_feed_result_document(self, feedDocumentId, **kwargs) -> str:
|
|
212
225
|
"""
|
|
213
226
|
get_feed_result_document(self, feedDocumentId, **kwargs) -> str
|
|
@@ -223,17 +236,25 @@ class Feeds(Client):
|
|
|
223
236
|
Returns:
|
|
224
237
|
str:
|
|
225
238
|
"""
|
|
226
|
-
response = self._request(
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
239
|
+
response = self._request(
|
|
240
|
+
fill_query_params(kwargs.pop("path"), feedDocumentId),
|
|
241
|
+
params=kwargs,
|
|
242
|
+
add_marketplace=False,
|
|
243
|
+
)
|
|
244
|
+
url = response.payload.get("url")
|
|
245
|
+
with httpx.Client() as client:
|
|
246
|
+
doc_response = client.get(url)
|
|
247
|
+
|
|
248
|
+
encoding = (
|
|
249
|
+
doc_response.encoding
|
|
250
|
+
if doc_response and doc_response.encoding
|
|
251
|
+
else "iso-8859-1"
|
|
252
|
+
)
|
|
253
|
+
if encoding.lower() == "windows-31j":
|
|
254
|
+
encoding = "cp932"
|
|
234
255
|
|
|
235
256
|
content = doc_response.content
|
|
236
|
-
if
|
|
257
|
+
if "compressionAlgorithm" in response.payload:
|
|
237
258
|
try:
|
|
238
259
|
return zlib.decompress(bytearray(content), 15 + 32).decode(encoding)
|
|
239
260
|
except Exception:
|
sp_api/api/finances/finances.py
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
|
+
import enum
|
|
2
|
+
|
|
1
3
|
from sp_api.base import Client, Marketplaces, ApiResponse
|
|
2
4
|
from sp_api.base import sp_endpoint, fill_query_params
|
|
3
5
|
|
|
6
|
+
class FinancesVersion(str, enum.Enum):
|
|
7
|
+
V_0 = "v0"
|
|
8
|
+
V_2024_06_19 = "2024-06-19"
|
|
9
|
+
LATEST = "2024-06-19"
|
|
10
|
+
|
|
4
11
|
|
|
5
12
|
class Finances(Client):
|
|
13
|
+
version: FinancesVersion = FinancesVersion.V_0
|
|
14
|
+
|
|
15
|
+
def __init__(self, *args, **kwargs):
|
|
16
|
+
if "version" in kwargs:
|
|
17
|
+
self.version = kwargs.get("version", FinancesVersion.V_0)
|
|
18
|
+
super().__init__(*args, **{**kwargs, "version": self.version})
|
|
6
19
|
|
|
7
|
-
@sp_endpoint(
|
|
20
|
+
@sp_endpoint("/finances/<version>/orders/{}/financialEvents")
|
|
8
21
|
def get_financial_events_for_order(self, order_id, **kwargs) -> ApiResponse:
|
|
9
22
|
"""
|
|
10
23
|
get_financial_events_for_order(self, order_id, **kwargs) -> ApiResponse
|
|
@@ -21,9 +34,11 @@ class Finances(Client):
|
|
|
21
34
|
Returns:
|
|
22
35
|
|
|
23
36
|
"""
|
|
24
|
-
return self._request(
|
|
37
|
+
return self._request(
|
|
38
|
+
fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
|
|
39
|
+
)
|
|
25
40
|
|
|
26
|
-
@sp_endpoint(
|
|
41
|
+
@sp_endpoint("/finances/<version>/financialEvents")
|
|
27
42
|
def list_financial_events(self, **kwargs) -> ApiResponse:
|
|
28
43
|
"""
|
|
29
44
|
list_financial_events(self, **kwargs) -> ApiResponse:
|
|
@@ -35,10 +50,12 @@ class Finances(Client):
|
|
|
35
50
|
Returns:
|
|
36
51
|
|
|
37
52
|
"""
|
|
38
|
-
return self._request(fill_query_params(kwargs.pop(
|
|
53
|
+
return self._request(fill_query_params(kwargs.pop("path")), params={**kwargs})
|
|
39
54
|
|
|
40
|
-
@sp_endpoint(
|
|
41
|
-
def list_financial_events_by_group_id(
|
|
55
|
+
@sp_endpoint("/finances/<version>/financialEventGroups/{}/financialEvents")
|
|
56
|
+
def list_financial_events_by_group_id(
|
|
57
|
+
self, event_group_id, **kwargs
|
|
58
|
+
) -> ApiResponse:
|
|
42
59
|
"""
|
|
43
60
|
list_financial_events_by_groupid(self, event_group_id, **kwargs) -> ApiResponse:
|
|
44
61
|
|
|
@@ -50,9 +67,11 @@ class Finances(Client):
|
|
|
50
67
|
Returns:
|
|
51
68
|
|
|
52
69
|
"""
|
|
53
|
-
return self._request(
|
|
70
|
+
return self._request(
|
|
71
|
+
fill_query_params(kwargs.pop("path"), event_group_id), params={**kwargs}
|
|
72
|
+
)
|
|
54
73
|
|
|
55
|
-
@sp_endpoint(
|
|
74
|
+
@sp_endpoint("/finances/<version>/financialEventGroups")
|
|
56
75
|
def list_financial_event_groups(self, **kwargs) -> ApiResponse:
|
|
57
76
|
"""
|
|
58
77
|
list_financial_event_groups(self, **kwargs) -> ApiResponse:
|
|
@@ -64,5 +83,17 @@ class Finances(Client):
|
|
|
64
83
|
Returns:
|
|
65
84
|
|
|
66
85
|
"""
|
|
67
|
-
return self._request(kwargs.pop(
|
|
86
|
+
return self._request(kwargs.pop("path"), params={**kwargs})
|
|
87
|
+
|
|
88
|
+
@sp_endpoint("/finances/<version>/transactions")
|
|
89
|
+
def list_transactions(self, **kwargs) -> ApiResponse:
|
|
90
|
+
"""
|
|
91
|
+
list_transactions(self, **kwargs) -> ApiResponse:
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
**kwargs:
|
|
95
|
+
|
|
96
|
+
Returns: ApiResponse
|
|
97
|
+
"""
|
|
68
98
|
|
|
99
|
+
return self._request(kwargs.pop("path"), params={**kwargs})
|