Question

am sorry if it is considered duplicate, but i've tried all python modules that can communicate to Amazon API, but sadly, all of them seems to require the product ID to get the exact price! and what i need is a price from a product name!

lastly, i've tried an extension of Bottlenose its name is python-amazon-simple-product-api except that it has the same problem: how do i get only the price from the name of a product.

here is what i've tried:

product = api.search(Keyword = "playstation", SearchIndex='All')

for i, produ in enumerate(product):
    print "{0}. '{1}'".format(i, produ.title)

(this is the same result as using produ.price_and_currency which in the example with the file is used with ID)

and then give me this error:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build\bdist.win-amd64\egg\amazon\api.py", line 174, in __iter__
File "build\bdist.win-amd64\egg\amazon\api.py", line 189, in iterate_pages
File "build\bdist.win-amd64\egg\amazon\api.py", line 211, in _query amazon.api.SearchException: Amazon Search Error: 'AWS.MinimumParameterRequirement', 'Your request should have atleast 1 of the following parameters: 'Keywords','Title','Power','BrowseNode','Artist','Author','Actor','Director','AudienceRati g','Manufacturer','MusicLabel','Composer','Publisher','Brand','Conductor','Orchestra','Tex Stream','Cuisine','City','Neighborhood'.'

Edit: after correcting Keyword to Keywords i get a looong time response (infinite loop! and tried it sevral times)! not like returning just the whole XML, but when using only bottlenose, i ony get tags that dont have Price or something...

<ItemLink>
  <Description>Technical Details</Description>
    <URL>http://www.amazon.com/*****</URL>
</ItemLink>

Update2: it seems that amazon will return ALL results, so how to limit this to only the first bucket (because it gives results by groups of 10 results)

Was it helpful?

Solution 2

sorry for the delay, solved:

pagination is done using search_n :

test = api.search_n(10, Keywords='example name', SearchIndex='All') # this will return only 10 results

Link

OTHER TIPS

Without having experience with the Amazon API: it's a matter of performing the search properly and intelligently. Think about it carefully, and read through

http://docs.amazonwebservices.com/AWSECommerceService/2011-08-01/DG/ItemSearch.html

so that you don't miss any important search feature.

The response contains something between 0 and a zillion of items, depending on how intelligent you search query was. In any case, the items in the response identify themselves via their ASIN, the product ID. Example: <ASIN>B00021HBN6</ASIN>

After having collected ASINs via ItemSearch, you can perform an ItemLookup on these items in order to find further details, like the price.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top