API I am using: https://pypi.python.org/pypi/python-amazon-simple-product-api
I have this part of my code
from amazon.api import AmazonAPI products = self.amazon_api.search_n(1, Keywords=item['upc'], SearchIndex='All') Exception I got
SearchException: Amazon Search Error: 'AWS.ECommerceService.NoExactMatches', 'We did not find any matches for your request.' I tried catching it like this
try: products = self.amazon_api.search_n(1, Keywords=item['upc'], SearchIndex='All') found_match = True except SearchException: logging.warning("No search result found on Amazon for UPC: %s"%(item['upc'])) found_match = False But I got
NameError: global name 'SearchException' is not defined Then I did this in start of my script
from AWS.ECommerceService.NoExactMatches import SearchException But then I got this error
ImportError: No module named AWS.ECommerceService.NoExactMatches My question is how do I silently catch this specific SearchException exception?