Executing the command:
amazon = bottlenose.Amazon(AMAZON_ACCESS_KEY,AMAZON_SECRET_KEY,AMAZON_ASSOC_TAG)
response = amazon.ItemLookup(ItemId='B007OZNUCE')
I got the error:
Traceback (most recent call last):
File "exazapi.py", line 37, in <module>
response = amazon.ItemLookup(ItemId='B007OZNUCE')
File "C:\Python\lib\site-packages\bottlenose\api.py", line 274, in __call__
{'api_url': api_url, 'cache_url': cache_url})
File "C:\Python\lib\site-packages\bottlenose\api.py", line 235, in _call_api
return urllib2.urlopen(api_request, timeout=self.Timeout)
File "C:\Python\lib\urllib\request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "C:\Python\lib\urllib\request.py", line 531, in open
response = meth(req, response)
File "C:\Python\lib\urllib\request.py", line 641, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Python\lib\urllib\request.py", line 569, in error
return self._call_chain(*args)
File "C:\Python\lib\urllib\request.py", line 503, in _call_chain
result = func(*args)
File "C:\Python\lib\urllib\request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 503: Service Unavailable
#import all the required modules
import re
import csv
import sys
import warnings
from urllib.request import urlopen
from bs4 import BeautifulSoup
from requests_html import HTMLSession
import bottlenose
#from amazon.api import AmazonAPI
AMAZON_ACCESS_KEY='xxx'
AMAZON_SECRET_KEY='xxx'
AMAZON_ASSOC_TAG='xxx'
#ignore warnings
if not sys.warnoptions:
warnings.simplefilter("ignore")
amazon = bottlenose.Amazon(AMAZON_ACCESS_KEY,AMAZON_SECRET_KEY,AMAZON_ASSOC_TAG)
response = amazon.ItemLookup(ItemId='B007OZNUCE')
print (amazon)
print(response)
Region is missing, add something like "DE" or "ES" depending on the country you're using.
Default is 'US':
amazon = bottlenose.Amazon(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_ASSOCIATE_TAG, Region='FR')
from: https://github.com/lionheart/bottlenose
Additionally: have you checked in the 'amazon' customer portal, on the 'platform API' access for the countries you want to use, that the API is enabled?
France: https://partenaires.amazon.fr/assoc_credentials/home
UK: https://affiliate-program.amazon.co.uk/assoc_credentials/home
US: https://affiliate-program.amazon.com/assoc_credentials/home
For me, it shows inactive, hence, that's probably the cause for the request to be denied.