yoavaviram / python-amazon-simple-product-api

A simple Python wrapper for the Amazon.com Product Advertising API ⛺
Apache License 2.0
815 stars 212 forks source link

urllib2.HTTPError: HTTP Error 503: Service Unavailable #160

Closed Karlheinzniebuhr closed 5 years ago

Karlheinzniebuhr commented 5 years ago

I'm getting this error on my gcloud app which runs python 2.7.16 Same error occurs on python 3.7.1 when executing the command line demo of the documentation

>>> amazon.lookup(ItemId='B07MFZY2F2') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python27\lib\site-packages\amazon\api.py", line 174, in lookup response = self.api.ItemLookup(ResponseGroup=ResponseGroup, **kwargs) File "C:\Python27\lib\site-packages\bottlenose\api.py", line 274, in __call__ {'api_url': api_url, 'cache_url': cache_url}) File "C:\Python27\lib\site-packages\bottlenose\api.py", line 235, in _call_api return urllib2.urlopen(api_request, timeout=self.Timeout) File "C:\Python27\lib\urllib2.py", line 154, in urlopen return opener.open(url, data, timeout) File "C:\Python27\lib\urllib2.py", line 435, in open response = meth(req, response) File "C:\Python27\lib\urllib2.py", line 548, in http_response 'http', request, response, code, msg, hdrs) File "C:\Python27\lib\urllib2.py", line 473, in error return self._call_chain(*args) File "C:\Python27\lib\urllib2.py", line 407, in _call_chain result = func(*args) File "C:\Python27\lib\urllib2.py", line 556, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 503: Service Unavailable

prafulbagai708 commented 5 years ago

Same Error. Were you able to fix this?

Karlheinzniebuhr commented 5 years ago

Nope :(

prafulbagai708 commented 5 years ago

@Karlheinzniebuhr - I found the issue. You need to pass region too. See the code snippet below.

amazon = AmazonAPI(AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAG, region='IN')

By default, it's US. If your affiliateId belongs to some other region, pass into it.

Check this file.

ankurpandeyvns commented 5 years ago

@Karlheinzniebuhr - I found the issue. You need to pass region too. See the code snippet below.

amazon = AmazonAPI(AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAG, region='IN')

By default, it's US. If your affiliateId belongs to some other region, pass into it.

Check this file.

Still raises the same exception.

Karlheinzniebuhr commented 5 years ago

T

@Karlheinzniebuhr - I found the issue. You need to pass region too. See the code snippet below. amazon = AmazonAPI(AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAG, region='IN') By default, it's US. If your affiliateId belongs to some other region, pass into it. Check this file.

Still raises the same exception.

Thanks @ankurpandeyvns , my code just magically started working again, the only thing I did was to get a new API key and wait a few days.