Skip to content

Commit e14cd58

Browse files
committed
Solve NoneType object is not iterable issue
1 parent 6abe57c commit e14cd58

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

amazon/paapi.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,11 @@ def search_products(self, item_count=10, item_page=1, items_per_page=10, keyword
279279
raise AmazonException('ApiException', e)
280280
try:
281281
if response.search_result is not None:
282-
for item in response.search_result.items:
283-
results.append(parse_product(item))
284-
if len(results) >= item_count:
285-
break
282+
if response.search_result.items is not None:
283+
for item in response.search_result.items:
284+
results.append(parse_product(item))
285+
if len(results) >= item_count:
286+
break
286287
else:
287288
break
288289
if response.errors is not None:
@@ -365,10 +366,11 @@ def get_variations(self, asin, item_count=10, item_page=1, items_per_page=10, co
365366
raise AmazonException('ApiException', e)
366367
try:
367368
if response.variations_result is not None:
368-
for item in response.variations_result.items:
369-
results.append(parse_product(item))
370-
if len(results) >= item_count:
371-
break
369+
if response.variations_result.items is not None:
370+
for item in response.variations_result.items:
371+
results.append(parse_product(item))
372+
if len(results) >= item_count:
373+
break
372374
else:
373375
break
374376
if response.errors is not None:

0 commit comments

Comments
 (0)