Skip to content

Commit a9fd886

Browse files
committed
Added docstrings to get_variations
1 parent 877c424 commit a9fd886

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

amazon/paapi.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,30 @@ def search_products(self, item_count=10, item_page=1, items_per_page=10, keyword
298298

299299
def get_variations(self, asin, item_count=10, item_page=1, items_per_page=10, condition='Any',
300300
merchant='All', async_req=False):
301+
"""Returns a set of items that are the same product, but differ according to a
302+
consistent theme, for example size and color.
301303
304+
Args:
305+
asin (str): One item ID like ASIN or product URL.
306+
item_count (int, optional): The total number of products to get. Should be between
307+
1 and 100. Defaults to 10.
308+
item_page (int, optional): The page where the results start from. Should be between
309+
1 and 10. Defaults to 1.
310+
items_per_page (int, optional): Products on each page. Should be between
311+
1 and 10. Defaults to 10.
312+
condition (str, optional): The condition parameter filters offers by
313+
condition type. Allowed values: Any, Collectible, New, Refurbished, Used.
314+
Defaults to Any.
315+
merchant (str, optional): Filters search results to return items
316+
having at least one offer sold by target merchant. Allowed values:
317+
All, Amazon. Defaults to All.
318+
async_req (bool, optional): Specify if a thread should be created to
319+
run the request. Defaults to False.
320+
321+
Returns:
322+
list of instances: A list containing 1 instance for each product
323+
or None if no results.
324+
"""
302325
if items_per_page > 10 or items_per_page < 1:
303326
raise AmazonException('ValueError', 'Arg items_per_page should be between 1 and 10')
304327
if item_count > 100 or item_count < 1:
@@ -313,7 +336,7 @@ def get_variations(self, asin, item_count=10, item_page=1, items_per_page=10, co
313336
partner_tag=self.tag,
314337
partner_type=PartnerType.ASSOCIATES,
315338
marketplace=self.marketplace,
316-
asin=asin,
339+
asin=get_asin(asin),
317340
condition=CONDITION[condition],
318341
merchant=merchant,
319342
offer_count=1,

0 commit comments

Comments
 (0)