Skip to content

Commit b111b0a

Browse files
committed
Solved unnecessary API call for get_variations and search_products
1 parent 5b32a37 commit b111b0a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

amazon/paapi.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ def search_products(self, item_count=10, item_page=1, items_per_page=10, keyword
286286
results.append(parse_product(item))
287287
if len(results) >= item_count:
288288
break
289+
if len(response.search_result.items) < items_per_page:
290+
break
289291
else:
290292
break
291293
if response.errors is not None:
@@ -373,6 +375,8 @@ def get_variations(self, asin, item_count=10, item_page=1, items_per_page=10, co
373375
results.append(parse_product(item))
374376
if len(results) >= item_count:
375377
break
378+
if len(response.variations_result.items) < items_per_page:
379+
break
376380
else:
377381
break
378382
if response.errors is not None:

0 commit comments

Comments
 (0)