Skip to content

Commit

Permalink
Handle empty response
Browse files Browse the repository at this point in the history
  • Loading branch information
leonghui committed Nov 3, 2024
1 parent 823215b commit 3dd3717
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions amazon_feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,15 @@ def get_search_results(search_query):
k: v
for k, v in json_dict.items()
if k.startswith("data-main-slot:search-result-")
}
} if json_dict else {}

if search_query.strict:
term_list = set([term.lower() for term in search_query.query_str.split()])
logger.debug(
f'"{search_query.query_str}" - strict mode enabled, title or asin must contain: {term_list}'
)

results_count = (
json_dict.get("data-search-metadata").get("metadata").get("totalResultCount")
)
results_count = len(results_dict)

generated_items = []

Expand Down

0 comments on commit 3dd3717

Please sign in to comment.