using bottlenose in python to extract product price from Amazon in different locale

Question:

I am using bottlenose to extract product prices from Amazon, things are doing OK for extraction from Amazon.com, I tried to expand the search to Amazon.co.uk, I applied an associate account in Amazon.co.uk, and obtained a new associate-id.

amazon_search = bottlenose.Amazon(str(aws_key.aws_access_key),
                                  str(aws_key.aws_secret_key),
                                  str(aws_key.aws_associate_key),
                                  MaxQPS=0.9)

item_details = BeautifulStoneSoup(amazon_search.ItemLookup(ItemId=item_asin.text,ResponseGroup="OfferSummary")

I used the code above, Why the output is the same for Amazon.com and Amazon.co.uk even after I changed the associate_key?

Asked By: lokheart

||

Answers:

listing the attribute inside the amazon_search class will tell you why:

print amazon_search.__dict__

{'MaxQPS': 0.9, 'AWSAccessKeyId': 'xxxxxxxxxx', '_last_query_time': [None], 'AWSSecretAccessKey': 'xxxxxxxxxx', 'Region': 'US', 'Parser': None, 'CacheReader': <function amazon_search_details_cache_read_fx at 0x31841b8>, 'ErrorHandler': None, 'Version': '2011-08-01', 'Timeout': None, 'AssociateTag': 'xxxxxxxxxx-20', 'CacheWriter': <function amazon_search_details_cache_write_fx at 0x31840c8>, 'Operation': None}

add attribute Region to whatever region you want will fix the problem. Just tested and it works.

Answered By: lokheart