我想使用 python-amazon-product-api 和 lxml.objectify 对 Amazon 产品 API 进行简单查询。
from amazonproduct import API
AWS_KEY = '..'
SECRET_KEY = '..'
api = API(AWS_KEY, SECRET_KEY, 'de')
node = api.item_search('Books', Publisher='Galileo Press')
# node object returned is a lxml.objectified element
# .pyval will convert the node content into int here
total_results = node.Items.TotalResults.pyval # <--- error
total_pages = node.Items.TotalPages.pyval
# get all books from result set and print author and title
for book in node.Items.Item:
print '%s: "%s"' % (book.ItemAttributes.Author, book.ItemAttributes.Title)
错误信息:
AttributeError:“LxmlItemSearchPaginator”对象没有属性“项目”
lxml 已正确安装!
错误在哪里?