amazon产品api返回HTTP错误400:错误的请求

时间:2016-08-22 22:16:19

标签: python amazon amazon-product-api

之前我使用亚马逊产品API访问数据,这很容易。我所要做的就是制作一些api密钥并在Python中使用一个模块并返回数据。 然而,这是4-5个月前,现在当我尝试使用api键时,它给我400错误。

这是我的代码

from amazon.api import AmazonAPI

asin = 'B00CAB5ZKC'
AMAZON_ACCESS_KEY='AKIAI4ZP7EZGNSTAWKTA'
AMAZON_SECRET_KEY ='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'
AMAZON_ASSOC_TAG =246152698300 
amazon = AmazonAPI(AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAG, region = "DE")
product = amazon.lookup(ItemId=asin, Condition='All', MerchantId='All')

这是我得到的错误

Traceback (most recent call last):
  File "C:\Users\Hari\Documents\Python\data\amazon_test_script.py", line 22, in <module>
    product = amazon.lookup(ItemId=asin, Condition='All', MerchantId='All')
  File "build\bdist.win-amd64\egg\amazon\api.py", line 173, in lookup
    response = self.api.ItemLookup(ResponseGroup=ResponseGroup, **kwargs)
  File "C:\Python27\lib\site-packages\bottlenose\api.py", line 265, in __call__
    {'api_url': api_url, 'cache_url': cache_url})
  File "C:\Python27\lib\site-packages\bottlenose\api.py", line 226, 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 437, in open
    response = meth(req, response)
  File "C:\Python27\lib\urllib2.py", line 550, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python27\lib\urllib2.py", line 475, in error
    return self._call_chain(*args)
  File "C:\Python27\lib\urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 558, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
  HTTPError: HTTP Error 400: Bad Request
    >>> 

我现在已经调试了2天,没有成功。谁能告诉我我错过了什么。

0 个答案:

没有答案