ResultPaginator raises IndexError for reviews

Issue #2 resolved
Sebastian Rahlf
repo owner created an issue

I wanted to get a list of reviews for a particular book. When using the ResultPaginator from the examples

{{{ paginator = amazonproduct.ResultPaginator('ReviewPage', '//aws:Items/aws:Request/aws:ItemLookupRequest/aws:ReviewPage', '//aws:Items/aws:Item/aws:CustomerReviews/aws:TotalReviewPages', '//aws:Items/aws:Item/aws:CustomerReviews/aws:TotalReviews')

for root in paginator(api.item_lookup, id=isbn, IdType='ISBN', SearchIndex='Books', ResponseGroup='Reviews'): ... }}}

I got the following error.

{{{ Traceback (most recent call last): File ".../reviews/", line 257, in <module> for review in get_amazon_reviews(title['isbn']): File ".../reviews/", line 122, in get_amazon_reviews SearchIndex='Books', ResponseGroup='Reviews'): File ".../site-packages/", line 410, in call total_results = self.get_total_results(root) File ".../site-packages/", line 436, in get_total_results namespaces={'aws' : self.nspace})[0].pyval IndexError: list index out of range }}}

Turns out that the Reviews node wasn't in the XML response.

Comments (2)

  1. Log in to comment