-
-
Notifications
You must be signed in to change notification settings - Fork 251
Expand file tree
/
Copy pathcatalog.py
More file actions
74 lines (52 loc) · 2.33 KB
/
catalog.py
File metadata and controls
74 lines (52 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import urllib.parse
from sp_api.base import Client, sp_endpoint, fill_query_params, ApiResponse
from sp_api.util import encode_kwarg
class Catalog(Client):
"""
:link: https://github.com/amzn/selling-partner-api-docs/blob/main/references/catalog-items-api/catalogItemsV0.md
"""
@sp_endpoint("/catalog/v0/items/{}")
def get_item(self, asin: str, **kwargs) -> ApiResponse:
"""
get_item(self, asin, **kwargs) -> ApiResponse
Returns a specified item and its attributes.
Examples:
literal blocks::
Catalog().get_item("value")
Args:
asin: | required
**kwargs:
Returns:
ApiResponse
"""
return self._request(fill_query_params(kwargs.pop("path"), asin), params=kwargs)
@sp_endpoint("/catalog/v0/items")
def list_items(self, **kwargs) -> ApiResponse:
"""
list_items(self, **kwargs) -> ApiResponse
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.
Examples:
literal blocks::
Catalog().list_items()
Args:
**kwargs:
Returns:
ApiResponse
"""
encode_kwarg(kwargs, "Query", urllib.parse.quote_plus)
return self._request(kwargs.pop("path"), params=kwargs)
@sp_endpoint("/catalog/v0/categories")
def list_categories(self, **kwargs) -> ApiResponse:
"""
list_categories(self, **kwargs) -> ApiResponse
Returns the parent categories to which an item belongs, based on the specified ASIN or SellerSKU
Examples:
literal blocks::
Catalog().list_categories()
Args:
**kwargs:
Returns:
ApiResponse
"""
encode_kwarg(kwargs, "Query", urllib.parse.quote_plus)
return self._request(kwargs.pop("path"), params=kwargs)