brain storm
brain storm

Reputation: 31252

what is the item identifier in python-amazon-product-api?

Here is the sample code from the 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)

what I don't understand is the Identifier used for the item_lookup(). My idea is to get reviews for some product as shown here, but I want to use a product name, instead of identifer. say for example: Bamboo stylus. How can I achieve this?

>>> api.item_lookup('0316067938', ResponseGroup='Reviews',
...     TruncateReviewsAt=256, IncludeReviewsSummary=False)

EDIT: I tried this: but it throws 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)

I tried this: but I get a different error:

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)

Please note that I do have keywords in the parameter request

Upvotes: 0

Views: 339

Answers (1)

Bibhas Debnath
Bibhas Debnath

Reputation: 14939

You need item_search. Bamboo stylus is too generic a term to identify a single product. The identifier is kind of like a Primary key. So first search for the product using item_search, pick up your item and then fetch reviews using that item's identifier. E.g. -

>>> api.item_search('Blended', Keywords='Mustang')

List of parameters you can send as query are listed in the doc.

Upvotes: 1

Related Questions