[英]what is the item identifier in python-amazon-product-api?
這是python-amazon-product-api的示例代碼
>>> api = API(locale='uk')
>>> result = api.item_lookup('B006H3MIV8')
>>> for item in result.Items.Item:
... print '%s (%s) in group %s' % (
... item.ItemAttributes.Title, item.ASIN)
...
Chimes of Freedom: The Songs of Bob Dylan (B006H3MIV8)
我不明白的是用於item_lookup()
的Identifier
。 我的想法是獲得某些產品的評論,如此處所示,但我想使用產品名稱,而不是標識符。 例如說: Bamboo stylus
。 我該如何實現?
>>> api.item_lookup('0316067938', ResponseGroup='Reviews',
... TruncateReviewsAt=256, IncludeReviewsSummary=False)
編輯:我嘗試過此方法:但是它拋出AttributeError: no such child
for item in api.item_search('DVD', Actor="Keanu Reaves",limit=10):
print '%s: "%s"' % (item.ItemAttributes.Identifier,
item.ItemAttributes.Title)
我試過這個:但是我得到了另一個錯誤:
mazonproduct.errors.AWSError: AWS.MinimumParameterRequirement: Your request should have atleast 1 of the following parameters: 'Keywords','Title','Power','BrowseNode','Artist','Author','Actor','Director','AudienceRating','Manufacturer','MusicLabel','Composer','Publisher','Brand','Conductor','Orchestra','TextStream','Cuisine','City','Neighborhood'.
for item in api.item_search('Blended', keywords="Keanu Reaves"):
print '%s: "%s"' % (item.ItemAttributes.Actor,
item.ItemAttributes.Title)
請注意,我在parameter request
確實有keywords
您需要item_search
。 Bamboo stylus
太籠統了,無法識別單個產品。 標識符有點像主鍵。 因此,首先使用item_search
搜索產品,拿起您的商品,然后使用該商品的標識符獲取評論。 例如-
>>> api.item_search('Blended', Keywords='Mustang')
您可以作為query
發送的參數列表在doc中列出。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.