1

とにかく、次のコードを使用して、Amazon API への簡単なリクエストを書き込もうとしています。

ak = "***"  
sk = "***"
at = "***"

import bottlenose
amazon = bottlenose.Amazon(ak, sk, at, "DE")
response=amazon.ItemLookup(ItemId="B00KWAO4CI")
print(response.price_and_currency)

XML オブジェクトを返す必要があります。代わりに、次の結果が得られます。

Traceback (most recent call last):
  File "simpleamazon.py", line 7, in <module>
    response=amazon.ItemLookup(ItemId="B00KWAO4CI")
  File "/Library/Python/2.7/site-packages/bottlenose/api.py", line 251, in __call__
    {'api_url': api_url, 'cache_url': cache_url})
  File "/Library/Python/2.7/site-packages/bottlenose/api.py", line 212, in _call_api
    return urllib2.urlopen(api_request, timeout=self.Timeout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 437, in open
    response = meth(req, response)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 550, in http_response
    'http', request, response, code, msg, hdrs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 475, in error
    return self._call_chain(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 558, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: Forbidden

Up until recently I received HTTP Error 400 instead. To my knowledge I haven't changed anything. I've also tried using response groups, but it resulted in the same error(s).

手がかりはありますか?

Python 3.5.2 の使用

4

0 に答える 0