I also had a similar problem, the node in the example contains LxmlItemSearchPaginator instead of the actual result. Here is a complete working example.
from amazonproduct import API
AWS_KEY = '...'
SECRET_KEY = '...'
if __name__ == '__main__':
api = API(AWS_KEY, SECRET_KEY, 'us')
for root in api.item_search('Books', Publisher='Apress',
ResponseGroup='Large'):
total_results = root.Items.TotalResults.pyval
total_pages = root.Items.TotalPages.pyval
try:
current_page = root.Items.Request.ItemSearchRequest.ItemPage.pyval
except AttributeError:
current_page = 1
print 'page %d of %d' % (current_page, total_pages)
nspace = root.nsmap.get(None, '')
books = root.xpath('//aws:Items/aws:Item',
namespaces={'aws' : nspace})
for book in books:
print book.ASIN,
if hasattr(book.ItemAttributes, 'Author'):
print unicode(book.ItemAttributes.Author), ':',
print unicode(book.ItemAttributes.Title),
if hasattr(book.ItemAttributes, 'ListPrice'):
print unicode(book.ItemAttributes.ListPrice.FormattedPrice)
elif hasattr(book.OfferSummary, 'LowestUsedPrice'):
print u'(used from %s)' % book.OfferSummary.LowestUsedPrice.FormattedPrice
source
share