从Python Amazon产品广告API ItemSearch获取产品的销售排名

2024-03-29 09:25:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用Python从Amazon产品广告API获得了一个基于搜索索引、浏览节点和关键字的产品列表。现在我要得到我已经获得的20种产品的销售排名,但我无法打印价值。我可以按产品的销售排名对列表进行排序,但这并没有给我每个产品对应的销售排名的值。在

以下是我目前为止的代码:

from amazonproduct import api
import lxml

api = API(locale='us')

def search(index, keyword):
    items = api.item_search(index, BrowseNode = '', Keywords = keyword)
    return items

result = search("Books", "Harry Potter")

count = 0
for item in result:
    print "%s" % (item.ItemAttributes.Title)
    count += 1
    if count == 20:
        break

我最近刚刚研究了amazonapi,我对它相当陌生,所以我一直在阅读文档并依靠它来解决问题。在

如有助于打印销售排名,我们将不胜感激。谢谢!在


Tags: importapiamazon列表searchindex节点产品