from amazon.api import AmazonAPI AMAZON_ACCESS_KEY = "A******************A" AMAZON_SECRET_KEY = "7***********************E" AMAZON_ASSOC_TAG = "j*****-20" amazon = AmazonAPI(AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAG, region='US') print(amazon) #product = amazon.lookup(ItemId='B002RL8FBQ')
When I run the code above, it works fine, and I get this output from the print function: <amazon.api.AmazonAPI object at 0x7fb6e59f7b38>
So, everything works fine with my passkey, secret key and associated tag.
However, if I comment on the last line #product = amazon.lookup(ItemId='B00EOE0WKQ') , I get this error trace:
Traceback (most recent call last): File "test.py", line 8, in <module> product = amazon.lookup(ItemId='B00EOE0WKQ') File "/home/darren/Python_projects/amazon_wp/myvenv/lib/python3.4/site-packages/amazon/api.py", line 173, in lookup response = self.api.ItemLookup(ResponseGroup=ResponseGroup, **kwargs) File "/home/darren/Python_projects/amazon_wp/myvenv/lib/python3.4/site-packages/bottlenose/api.py", line 251, in __call__ {'api_url': api_url, 'cache_url': cache_url}) File "/home/darren/Python_projects/amazon_wp/myvenv/lib/python3.4/site-packages/bottlenose/api.py", line 212, in _call_api return urllib2.urlopen(api_request, timeout=self.Timeout) File "/usr/lib/python3.4/urllib/request.py", line 161, in urlopen return opener.open(url, data, timeout) File "/usr/lib/python3.4/urllib/request.py", line 469, in open response = meth(req, response) File "/usr/lib/python3.4/urllib/request.py", line 579, in http_response 'http', request, response, code, msg, hdrs) File "/usr/lib/python3.4/urllib/request.py", line 507, in error return self._call_chain(*args) File "/usr/lib/python3.4/urllib/request.py", line 441, in _call_chain result = func(*args) File "/usr/lib/python3.4/urllib/request.py", line 587, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 400: Bad Request
I followed the instructions from official github for this https://github.com/yoavaviram/python-amazon-simple-product-api , and the code that I use, you will see that I used from the subheading "Use" on the github page, so I'm not sure what is going wrong.
For more information, I use the virtual environment and show that I have the correct packages installed, this is my way out of the freeze:
(myvenv) darren@my_comp:~/Python_projects/amazon_wp$ pip3 freeze bottlenose==0.6.3 lxml==3.6.0 python-amazon-simple-product-api==2.1.0 python-dateutil==2.5.3 six==1.10.0
In addition, I have tried several different asin actual product numbers, and I am getting the same error message.
I am using python 3.4 on ubuntu 14.04