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,54 @@
|
|
|
1
|
+
import urllib.parse
|
|
2
|
+
|
|
3
|
+
from sp_api.base import ApiResponse, fill_query_params, sp_endpoint
|
|
4
|
+
from sp_api.asyncio.base import AsyncBaseClient
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Authorization(AsyncBaseClient):
|
|
8
|
+
"""
|
|
9
|
+
Authorization SP-API Client
|
|
10
|
+
:link:
|
|
11
|
+
|
|
12
|
+
The Selling Partner API for Authorization helps developers manage authorizations and check the specific permissions associated with a given authorization.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
grantless_scope = "sellingpartnerapi::migration"
|
|
16
|
+
|
|
17
|
+
@sp_endpoint("/authorization/v1/authorizationCode", method="GET")
|
|
18
|
+
async def get_authorization_code(self, **kwargs) -> ApiResponse:
|
|
19
|
+
"""
|
|
20
|
+
get_authorization_code(self, **kwargs) -> ApiResponse
|
|
21
|
+
|
|
22
|
+
With the getAuthorizationCode operation, you can request a Login With Amazon (LWA) authorization code that will allow you to call a Selling Partner API on behalf of a seller who has already authorized you to call Amazon Marketplace Web Service (Amazon MWS). You specify a developer ID, an MWS auth token, and a seller ID. Taken together, these represent the Amazon MWS authorization that the seller previously granted you. The operation returns an LWA authorization code that can be exchanged for a refresh token and access token representing authorization to call the Selling Partner API on the seller's behalf. By using this API, sellers who have already authorized you for Amazon MWS do not need to re-authorize you for the Selling Partner API.
|
|
23
|
+
|
|
24
|
+
**Usage Plan:**
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
====================================== ==============
|
|
28
|
+
Rate (requests per second) Burst
|
|
29
|
+
====================================== ==============
|
|
30
|
+
1 5
|
|
31
|
+
====================================== ==============
|
|
32
|
+
|
|
33
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
34
|
+
|
|
35
|
+
Examples:
|
|
36
|
+
literal blocks::
|
|
37
|
+
|
|
38
|
+
res = Authorization().get_authorization_code(
|
|
39
|
+
mwsAuthToken='test',
|
|
40
|
+
developerId='test',
|
|
41
|
+
sellingPartnerId='test'
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
key sellingPartnerId:string | * REQUIRED The seller ID of the seller for whom you are requesting Selling Partner API authorization. This must be the seller ID of the seller who authorized your application on the Marketplace Appstore.
|
|
47
|
+
key developerId:string | * REQUIRED Your developer ID. This must be one of the developer ID values that you provided when you registered your application in Developer Central.
|
|
48
|
+
key mwsAuthToken:string | * REQUIRED The MWS Auth Token that was generated when the seller authorized your application on the Marketplace Appstore.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
ApiResponse:
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
return await self._request_grantless_operation(kwargs.pop("path"), params=kwargs)
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import urllib.parse
|
|
2
|
+
|
|
3
|
+
from sp_api.base import ApiResponse, fill_query_params, sp_endpoint
|
|
4
|
+
from sp_api.util import encode_kwarg
|
|
5
|
+
from sp_api.asyncio.base import AsyncBaseClient
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Catalog(AsyncBaseClient):
|
|
9
|
+
"""
|
|
10
|
+
:link: https://github.com/amzn/selling-partner-api-docs/blob/main/references/catalog-items-api/catalogItemsV0.md
|
|
11
|
+
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
@sp_endpoint("/catalog/v0/items/{}")
|
|
15
|
+
async def get_item(self, asin: str, **kwargs) -> ApiResponse:
|
|
16
|
+
"""
|
|
17
|
+
get_item(self, asin: str, **kwargs) -> ApiResponse
|
|
18
|
+
Returns a specified item and its attributes.
|
|
19
|
+
|
|
20
|
+
**Usage Plan:**
|
|
21
|
+
|
|
22
|
+
====================================== ==============
|
|
23
|
+
Rate (requests per second) Burst
|
|
24
|
+
====================================== ==============
|
|
25
|
+
1 1
|
|
26
|
+
====================================== ==============
|
|
27
|
+
|
|
28
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
29
|
+
|
|
30
|
+
Examples:
|
|
31
|
+
literal blocks::
|
|
32
|
+
|
|
33
|
+
res = Catalog().get_item('ASIN_200', MarketplaceId='TEST_CASE_200')
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
asin: str
|
|
37
|
+
key MarketplaceId: str
|
|
38
|
+
**kwargs:
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
GetCatalogItemResponse:
|
|
42
|
+
"""
|
|
43
|
+
return await self._request(
|
|
44
|
+
fill_query_params(kwargs.pop("path"), asin), params=kwargs
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
@sp_endpoint("/catalog/v0/items")
|
|
48
|
+
async def list_items(self, **kwargs) -> ApiResponse:
|
|
49
|
+
"""
|
|
50
|
+
list_items(self, **kwargs) -> ApiResponse
|
|
51
|
+
Returns a list of items and their attributes, based on a search query or item identifiers that you specify. When based on a search query, provide the Query parameter and optionally, the QueryContextId parameter. When based on item identifiers, provide a single appropriate parameter based on the identifier type, and specify the associated item value. MarketplaceId is always required.
|
|
52
|
+
|
|
53
|
+
**Usage Plan:**
|
|
54
|
+
|
|
55
|
+
====================================== ==============
|
|
56
|
+
Rate (requests per second) Burst
|
|
57
|
+
====================================== ==============
|
|
58
|
+
1 1
|
|
59
|
+
====================================== ==============
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
63
|
+
|
|
64
|
+
Examples:
|
|
65
|
+
literal blocks::
|
|
66
|
+
|
|
67
|
+
res = Catalog().list_items(MarketplaceId='TEST_CASE_200', SellerSKU='SKU_200')
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
key MarketplaceId: str
|
|
71
|
+
key Query: str
|
|
72
|
+
key QueryContextId: str
|
|
73
|
+
key SellerSKU: str
|
|
74
|
+
key UPC: str
|
|
75
|
+
key EAN: str
|
|
76
|
+
key ISBN: str
|
|
77
|
+
key JAN: str
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
ListCatalogItemsResponse:
|
|
81
|
+
"""
|
|
82
|
+
encode_kwarg(kwargs, "Query", urllib.parse.quote_plus)
|
|
83
|
+
return await self._request(kwargs.pop("path"), params=kwargs)
|
|
84
|
+
|
|
85
|
+
@sp_endpoint("/catalog/v0/categories")
|
|
86
|
+
async def list_categories(self, **kwargs) -> ApiResponse:
|
|
87
|
+
"""
|
|
88
|
+
list_categories(self, **kwargs) -> ApiResponse
|
|
89
|
+
Returns the parent categories to which an item belongs, based on the specified ASIN or SellerSKU
|
|
90
|
+
|
|
91
|
+
**Usage Plan:**
|
|
92
|
+
|
|
93
|
+
====================================== ==============
|
|
94
|
+
Rate (requests per second) Burst
|
|
95
|
+
====================================== ==============
|
|
96
|
+
1 2
|
|
97
|
+
====================================== ==============
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
key MarketplaceId: str
|
|
104
|
+
key ASIN: str
|
|
105
|
+
key SellerSKU: str
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
ListCatalogCategoriesResponse:
|
|
109
|
+
"""
|
|
110
|
+
encode_kwarg(kwargs, "Query", urllib.parse.quote_plus)
|
|
111
|
+
return await self._request(kwargs.pop("path"), params=kwargs)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import enum
|
|
2
|
+
|
|
3
|
+
from sp_api.base import ApiResponse, fill_query_params, sp_endpoint
|
|
4
|
+
from sp_api.util import normalize_included_data
|
|
5
|
+
from sp_api.asyncio.base import AsyncBaseClient
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class CatalogItemsVersion(str, enum.Enum):
|
|
9
|
+
V_2020_12_01 = "2020-12-01"
|
|
10
|
+
V_2022_04_01 = "2022-04-01"
|
|
11
|
+
LATEST = "2022-04-01"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class CatalogItems(AsyncBaseClient):
|
|
15
|
+
"""
|
|
16
|
+
CatalogItems SP-API Client
|
|
17
|
+
:link:
|
|
18
|
+
|
|
19
|
+
The Selling Partner API for Catalog Items provides programmatic access to information about items in the Amazon catalog.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
version: CatalogItemsVersion = CatalogItemsVersion.V_2020_12_01
|
|
23
|
+
|
|
24
|
+
def __init__(self, *args, **kwargs):
|
|
25
|
+
if "version" in kwargs:
|
|
26
|
+
self.version = kwargs.get("version", CatalogItemsVersion.V_2020_12_01)
|
|
27
|
+
super().__init__(*args, **{**kwargs, "version": self.version})
|
|
28
|
+
|
|
29
|
+
@sp_endpoint("/catalog/<version>/items", method="GET")
|
|
30
|
+
async def search_catalog_items(self, **kwargs) -> ApiResponse:
|
|
31
|
+
"""
|
|
32
|
+
search_catalog_items(self, **kwargs) -> ApiResponse
|
|
33
|
+
|
|
34
|
+
Search for and return a list of Amazon catalog items and associated information.
|
|
35
|
+
|
|
36
|
+
**Usage Plans:**
|
|
37
|
+
|
|
38
|
+
====================================== ==============
|
|
39
|
+
Rate (requests per second) Burst
|
|
40
|
+
====================================== ==============
|
|
41
|
+
1 5
|
|
42
|
+
====================================== ==============
|
|
43
|
+
|
|
44
|
+
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.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
key keywords:array | * REQUIRED A comma-delimited list of words or item identifiers to search the Amazon catalog for.
|
|
48
|
+
key marketplaceIds:array | * REQUIRED A comma-delimited list of Amazon marketplace identifiers for the request.
|
|
49
|
+
key includedData:array | A comma-delimited string or list of data sets to include in the response. Default: summaries.
|
|
50
|
+
key brandNames:array | A comma-delimited list of brand names to limit the search to.
|
|
51
|
+
key classificationIds:array | A comma-delimited list of classification identifiers to limit the search to.
|
|
52
|
+
key pageSize:integer | Number of results to be returned per page.
|
|
53
|
+
key pageToken:string | A token to fetch a certain page when there are multiple pages worth of results.
|
|
54
|
+
key keywordsLocale:string | The language the keywords are provided in. Defaults to the primary locale of the marketplace.
|
|
55
|
+
key locale:string | Locale for retrieving localized summaries. Defaults to the primary locale of the marketplace.
|
|
56
|
+
|
|
57
|
+
Returns:
|
|
58
|
+
ApiResponse:
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
normalize_included_data(kwargs)
|
|
62
|
+
return await self._request(kwargs.pop("path"), params=kwargs)
|
|
63
|
+
|
|
64
|
+
@sp_endpoint("/catalog/<version>/items/{}", method="GET")
|
|
65
|
+
async def get_catalog_item(self, asin, **kwargs) -> ApiResponse:
|
|
66
|
+
"""
|
|
67
|
+
get_catalog_item(self, asin, **kwargs) -> ApiResponse
|
|
68
|
+
|
|
69
|
+
Retrieves details for an item in the Amazon catalog.
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
====================================== ==============
|
|
73
|
+
Rate (requests per second) Burst
|
|
74
|
+
====================================== ==============
|
|
75
|
+
5 5
|
|
76
|
+
====================================== ==============
|
|
77
|
+
|
|
78
|
+
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.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
asin:string | * REQUIRED The Amazon Standard Identification Number (ASIN) of the item.
|
|
82
|
+
key marketplaceIds:array | * REQUIRED A comma-delimited list of Amazon marketplace identifiers. Data sets in the response contain data only for the specified marketplaces.
|
|
83
|
+
key includedData:array | A comma-delimited string or list of data sets to include in the response. Default: summaries.
|
|
84
|
+
key locale:string | Locale for retrieving localized summaries. Defaults to the primary locale of the marketplace.
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
ApiResponse:
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
normalize_included_data(kwargs)
|
|
91
|
+
return await self._request(
|
|
92
|
+
fill_query_params(kwargs.pop("path"), asin), params=kwargs
|
|
93
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
from sp_api.base import ApiResponse, fill_query_params, sp_endpoint
|
|
2
|
+
from sp_api.asyncio.base import AsyncBaseClient
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class CustomerFeedback(AsyncBaseClient):
|
|
6
|
+
"""
|
|
7
|
+
The Selling Partner API for CustomerFeedback - 2024-06-01
|
|
8
|
+
|
|
9
|
+
The Selling Partner API for Customer Feedback (Customer Feedback API) provides information about customer reviews and returns at both the item and browse node level.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
@sp_endpoint(
|
|
13
|
+
"/customerFeedback/2024-06-01/items/{}/reviews/topics", method="GET"
|
|
14
|
+
)
|
|
15
|
+
async def get_item_review_topics(
|
|
16
|
+
self, asin, *args, **kwargs
|
|
17
|
+
) -> ApiResponse:
|
|
18
|
+
"""
|
|
19
|
+
Retrieve an item's ten most positive and ten most negative review topics.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
return await self._request(
|
|
23
|
+
fill_query_params(kwargs.pop('path'), asin), params=kwargs
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
@sp_endpoint("/customerFeedback/2024-06-01/items/{}/browseNode", method="GET")
|
|
27
|
+
async def get_item_browse_node(self, asin, *args, **kwargs) -> ApiResponse:
|
|
28
|
+
"""
|
|
29
|
+
This API returns the associated browse node of the requested ASIN. A browse node is a location in a browse tree that is used for navigation, product classification, and website content on the Amazon retail website.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
return await self._request(
|
|
33
|
+
fill_query_params(kwargs.pop('path'), asin), params=kwargs
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@sp_endpoint(
|
|
38
|
+
"/customerFeedback/2024-06-01/browseNodes/{}/reviews/topics",
|
|
39
|
+
method="GET",
|
|
40
|
+
)
|
|
41
|
+
async def get_browse_node_review_topics(
|
|
42
|
+
self, browseNodeId, *args, **kwargs
|
|
43
|
+
) -> ApiResponse:
|
|
44
|
+
"""
|
|
45
|
+
Retrieve a browse node's ten most positive and ten most negative review topics.
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
return await self._request(
|
|
49
|
+
fill_query_params(kwargs.pop('path'), browseNodeId), params=kwargs
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@sp_endpoint(
|
|
54
|
+
"/customerFeedback/2024-06-01/items/{}/reviews/trends", method="GET"
|
|
55
|
+
)
|
|
56
|
+
async def get_item_review_trends(
|
|
57
|
+
self, asin, *args, **kwargs
|
|
58
|
+
) -> ApiResponse:
|
|
59
|
+
"""
|
|
60
|
+
Retrieve an item's positive and negative review trends for the past six months.
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
return await self._request(
|
|
64
|
+
fill_query_params(kwargs.pop('path'), asin), params=kwargs
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
@sp_endpoint(
|
|
69
|
+
"/customerFeedback/2024-06-01/browseNodes/{}/reviews/trends",
|
|
70
|
+
method="GET",
|
|
71
|
+
)
|
|
72
|
+
async def get_browse_node_review_trends(
|
|
73
|
+
self, browseNodeId, *args, **kwargs
|
|
74
|
+
) -> ApiResponse:
|
|
75
|
+
"""
|
|
76
|
+
Retrieve the positive and negative review trends of items in a browse node for the past six months.
|
|
77
|
+
"""
|
|
78
|
+
|
|
79
|
+
return await self._request(
|
|
80
|
+
fill_query_params(kwargs.pop('path'), browseNodeId), params=kwargs
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
@sp_endpoint(
|
|
84
|
+
"/customerFeedback/2024-06-01/browseNodes/{}/returns/topics",
|
|
85
|
+
method="GET",
|
|
86
|
+
)
|
|
87
|
+
async def get_browse_node_return_topics(
|
|
88
|
+
self, browseNodeId, *args, **kwargs
|
|
89
|
+
) -> ApiResponse:
|
|
90
|
+
"""
|
|
91
|
+
Retrieve the topics that customers mention when they return items in a browse node.
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
return await self._request(
|
|
95
|
+
fill_query_params(kwargs.pop('path'), browseNodeId), params=kwargs
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
@sp_endpoint(
|
|
99
|
+
"/customerFeedback/2024-06-01/browseNodes/{}/returns/trends",
|
|
100
|
+
method="GET",
|
|
101
|
+
)
|
|
102
|
+
async def get_browse_node_return_trends(
|
|
103
|
+
self, browseNodeId, *args, **kwargs
|
|
104
|
+
) -> ApiResponse:
|
|
105
|
+
"""
|
|
106
|
+
Retrieve the trends of topics that customers mention when they return items in a browse node.
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
return await self._request(
|
|
110
|
+
fill_query_params(kwargs.pop('path'), browseNodeId), params=kwargs
|
|
111
|
+
)
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import urllib.parse
|
|
2
|
+
from io import BytesIO, StringIO
|
|
3
|
+
from typing import Union, BinaryIO, TextIO
|
|
4
|
+
|
|
5
|
+
from sp_api.base import ApiResponse, fill_query_params, sp_endpoint
|
|
6
|
+
from sp_api.asyncio.base import AsyncBaseClient
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class DataKiosk(AsyncBaseClient):
|
|
10
|
+
"""
|
|
11
|
+
DataKiosk SP-API Client
|
|
12
|
+
:link:
|
|
13
|
+
|
|
14
|
+
The Selling Partner API for Data Kiosk lets you submit GraphQL queries from a variety of schemas to help selling partners manage their businesses.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
@sp_endpoint("/dataKiosk/2023-11-15/queries", method="GET")
|
|
18
|
+
async def get_queries(self, **kwargs) -> ApiResponse:
|
|
19
|
+
"""
|
|
20
|
+
get_queries(self, **kwargs) -> ApiResponse
|
|
21
|
+
|
|
22
|
+
Returns details for the Data Kiosk queries that match the specified filters. See the `createQuery` operation for details about query retention.
|
|
23
|
+
|
|
24
|
+
**Usage Plan:**
|
|
25
|
+
|
|
26
|
+
====================================== ==============
|
|
27
|
+
Rate (requests per second) Burst
|
|
28
|
+
====================================== ==============
|
|
29
|
+
0.0222 10
|
|
30
|
+
====================================== ==============
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
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, refer to [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).
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
|
|
37
|
+
key processingStatuses:array | A list of processing statuses used to filter queries.
|
|
38
|
+
|
|
39
|
+
key pageSize:integer | The maximum number of queries to return in a single call.
|
|
40
|
+
|
|
41
|
+
key createdSince:string | The earliest query creation date and time for queries to include in the response, in ISO 8601 date time format. The default is 90 days ago.
|
|
42
|
+
|
|
43
|
+
key createdUntil:string | The latest query creation date and time for queries to include in the response, in ISO 8601 date time format. The default is the time of the `getQueries` request.
|
|
44
|
+
|
|
45
|
+
key paginationToken:string | A token to fetch a certain page of results when there are multiple pages of results available. The value of this token is fetched from the `pagination.nextToken` field returned in the `GetQueriesResponse` object. All other parameters must be provided with the same values that were provided with the request that generated this token, with the exception of `pageSize` which can be modified between calls to `getQueries`. In the absence of this token value, `getQueries` returns the first page of results.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
ApiResponse:
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
return await self._request(
|
|
53
|
+
kwargs.pop("path"),
|
|
54
|
+
params=kwargs,
|
|
55
|
+
add_marketplace=False,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
@sp_endpoint("/dataKiosk/2023-11-15/queries", method="POST")
|
|
59
|
+
async def create_query(self, query, pagination_token=None, **kwargs) -> ApiResponse:
|
|
60
|
+
"""
|
|
61
|
+
create_query(self, query, pagination_token=None, **kwargs) -> ApiResponse
|
|
62
|
+
|
|
63
|
+
Creates a Data Kiosk query request.
|
|
64
|
+
|
|
65
|
+
**Note:** The retention of a query varies based on the fields requested. Each field within a schema is annotated with a `@resultRetention` directive that defines how long a query containing that field will be retained. When a query contains multiple fields with different retentions, the shortest (minimum) retention is applied. The retention of a query's resulting documents always matches the retention of the query.
|
|
66
|
+
|
|
67
|
+
**Usage Plan:**
|
|
68
|
+
|
|
69
|
+
====================================== ==============
|
|
70
|
+
Rate (requests per second) Burst
|
|
71
|
+
====================================== ==============
|
|
72
|
+
0.0167 15
|
|
73
|
+
====================================== ==============
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
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, refer to [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).
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
|
|
80
|
+
query:string | * REQUIRED The query to submit. The query must be a valid GraphQL query in the schema specified by the `schema` parameter.
|
|
81
|
+
pagination_token:string | A token to fetch a certain page of results when there are multiple pages of results available. The value of this token is fetched from the `pagination.nextToken` field returned in the `GetQueriesResponse` object. All other parameters must be provided with the same values that were provided with the request that generated this token, with the exception of `pageSize` which can be modified between calls to `getQueries`. In the absence of this token value, `getQueries` returns the first page of results.
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
ApiResponse:
|
|
86
|
+
"""
|
|
87
|
+
kwargs["query"] = query
|
|
88
|
+
if pagination_token:
|
|
89
|
+
kwargs["paginationToken"] = pagination_token
|
|
90
|
+
return await self._request(
|
|
91
|
+
kwargs.pop("path"),
|
|
92
|
+
data=kwargs,
|
|
93
|
+
add_marketplace=False,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
@sp_endpoint("/dataKiosk/2023-11-15/queries/{}", method="DELETE")
|
|
97
|
+
async def cancel_query(self, query_id, **kwargs) -> ApiResponse:
|
|
98
|
+
"""
|
|
99
|
+
cancel_query(self, queryId, **kwargs) -> ApiResponse
|
|
100
|
+
|
|
101
|
+
Cancels the query specified by the `queryId` parameter. Only queries with a non-terminal `processingStatus` (`IN_QUEUE`, `IN_PROGRESS`) can be cancelled. Cancelling a query that already has a `processingStatus` of `CANCELLED` will no-op. Cancelled queries are returned in subsequent calls to the `getQuery` and `getQueries` operations.
|
|
102
|
+
|
|
103
|
+
**Usage Plan:**
|
|
104
|
+
|
|
105
|
+
====================================== ==============
|
|
106
|
+
Rate (requests per second) Burst
|
|
107
|
+
====================================== ==============
|
|
108
|
+
0.0222 10
|
|
109
|
+
====================================== ==============
|
|
110
|
+
|
|
111
|
+
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, refer to [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).
|
|
112
|
+
|
|
113
|
+
Args:
|
|
114
|
+
|
|
115
|
+
query_id:string | * REQUIRED The identifier for the query. This identifier is unique only in combination with a selling partner account ID.
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
Returns:
|
|
119
|
+
ApiResponse:
|
|
120
|
+
"""
|
|
121
|
+
|
|
122
|
+
return await self._request(
|
|
123
|
+
fill_query_params(kwargs.pop("path"), query_id),
|
|
124
|
+
data=kwargs,
|
|
125
|
+
add_marketplace=False,
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
@sp_endpoint("/dataKiosk/2023-11-15/queries/{}", method="GET")
|
|
129
|
+
async def get_query(self, query_id, **kwargs) -> ApiResponse:
|
|
130
|
+
"""
|
|
131
|
+
get_query(self, queryId, **kwargs) -> ApiResponse
|
|
132
|
+
|
|
133
|
+
Returns query details for the query specified by the `queryId` parameter. See the `createQuery` operation for details about query retention.
|
|
134
|
+
|
|
135
|
+
**Usage Plan:**
|
|
136
|
+
|
|
137
|
+
====================================== ==============
|
|
138
|
+
Rate (requests per second) Burst
|
|
139
|
+
====================================== ==============
|
|
140
|
+
2 15
|
|
141
|
+
====================================== ==============
|
|
142
|
+
|
|
143
|
+
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, refer to [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).
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
|
|
147
|
+
query_id:string | * REQUIRED The query identifier.
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
ApiResponse:
|
|
152
|
+
"""
|
|
153
|
+
|
|
154
|
+
return await self._request(
|
|
155
|
+
fill_query_params(kwargs.pop("path"), query_id),
|
|
156
|
+
params=kwargs,
|
|
157
|
+
add_marketplace=False,
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
@sp_endpoint("/dataKiosk/2023-11-15/documents/{}", method="GET")
|
|
161
|
+
async def get_document(
|
|
162
|
+
self,
|
|
163
|
+
document_id,
|
|
164
|
+
download: bool = False,
|
|
165
|
+
file: Union[BytesIO, str, BinaryIO, TextIO] = None,
|
|
166
|
+
encoding="utf-8",
|
|
167
|
+
**kwargs
|
|
168
|
+
) -> ApiResponse:
|
|
169
|
+
"""
|
|
170
|
+
get_document(self, document_id, download: bool = False, file: Union[BytesIO, str, BinaryIO, TextIO] = None, encoding='utf-8', **kwargs) -> ApiResponse
|
|
171
|
+
|
|
172
|
+
Returns the information required for retrieving a Data Kiosk document's contents. See the `createQuery` operation for details about document retention.
|
|
173
|
+
|
|
174
|
+
**Usage Plan:**
|
|
175
|
+
|
|
176
|
+
====================================== ==============
|
|
177
|
+
Rate (requests per second) Burst
|
|
178
|
+
====================================== ==============
|
|
179
|
+
0.0167 15
|
|
180
|
+
====================================== ==============
|
|
181
|
+
|
|
182
|
+
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, refer to [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).
|
|
183
|
+
|
|
184
|
+
Args:
|
|
185
|
+
|
|
186
|
+
document_id:string | * REQUIRED The identifier for the Data Kiosk document.
|
|
187
|
+
file: | * OPTIONAL The file to write the response to.
|
|
188
|
+
download: | * OPTIONAL If True, the file will be downloaded and returned in the payload.
|
|
189
|
+
encoding: | * OPTIONAL The encoding to use when writing the file. Defaults to utf-8, binary data is written if applicable filemode is passed.
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
Returns:
|
|
193
|
+
ApiResponse:
|
|
194
|
+
"""
|
|
195
|
+
|
|
196
|
+
res = await self._request(
|
|
197
|
+
fill_query_params(kwargs.pop("path"), document_id),
|
|
198
|
+
params=kwargs,
|
|
199
|
+
add_marketplace=False,
|
|
200
|
+
)
|
|
201
|
+
if download or file or ("decrypt" in kwargs and kwargs["decrypt"]):
|
|
202
|
+
document_response = await self._transport.request(
|
|
203
|
+
"GET",
|
|
204
|
+
res.payload.get("documentUrl"),
|
|
205
|
+
)
|
|
206
|
+
document = document_response.content
|
|
207
|
+
if download:
|
|
208
|
+
res.payload.update(
|
|
209
|
+
{
|
|
210
|
+
"document": document,
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
if file:
|
|
214
|
+
self._handle_file(file, document, encoding=encoding)
|
|
215
|
+
return res
|
|
216
|
+
|
|
217
|
+
@staticmethod
|
|
218
|
+
def _handle_file(file, document, encoding="utf-8"):
|
|
219
|
+
if isinstance(file, str):
|
|
220
|
+
if isinstance(document, bytes):
|
|
221
|
+
with open(file, "wb+") as f:
|
|
222
|
+
f.write(document)
|
|
223
|
+
else:
|
|
224
|
+
with open(file, "w+") as text_file:
|
|
225
|
+
text_file.write(document)
|
|
226
|
+
elif isinstance(file, BytesIO):
|
|
227
|
+
file.write(document)
|
|
228
|
+
file.seek(0)
|
|
229
|
+
elif isinstance(file, StringIO):
|
|
230
|
+
file.write(document.decode(encoding))
|
|
231
|
+
file.seek(0)
|
|
232
|
+
else:
|
|
233
|
+
if "b" in file.mode:
|
|
234
|
+
file.write(document)
|
|
235
|
+
else:
|
|
236
|
+
file.write(document.decode(encoding))
|