Python亚马逊MWS Api 400客户端错误请求错误

时间:2015-06-03 10:32:03

标签: python amazon-mws

您好我正在使用此github代码链接到amazon mws api以获取当前列出的订单。 Github python-amazon-aws
我的代码是:

import mws

auth = mws.Orders(access_key='AKIAJHSXMwdwdL4XJT7NVLAQ', secret_key='xbY5YTa4wwcqMD9dMJDOA0T3iRSL67vSYdRFz+Y4wGR', account_id='A3AZIT4DFSLU02M7', region='IN', domain='', uri="", version="", auth_token="")

auth.list_orders(marketplaceids='A21TJRUUN4KGV', created_after='2015-06-01', created_before=None, lastupdatedafter=None, lastupdatedbefore=None, orderstatus=(), fulfillment_channels=(), payment_methods=(), buyer_email=None, seller_orderid=None, max_results='100')

为了安全起见,访问密钥,密钥和帐户ID已更改。前两行代码工作正常。在添加第3行时,我收到此错误:

$python Orders.py 
Traceback (most recent call last):
  File "Orders.py", line 5, in <module>
    auth.list_orders(marketplaceids='A21TJRUUN4KGV', created_after='2015-06-01', created_before=None, lastupdatedafter=None, lastupdatedbefore=None, orderstatus=(), fulfillment_channels=(), payment_methods=(), buyer_email=None, seller_orderid=None, max_results='100')
  File "/usr/local/lib/python2.7/dist-packages/python_amazon_mws-0.6-py2.7.egg/mws/mws.py", line 421, in list_orders
return self.make_request(data)
  File "/usr/local/lib/python2.7/dist-packages/python_amazon_mws-0.6-py2.7.egg/mws/mws.py", line 210, in make_request
raise error
mws.mws.MWSError: 400 Client Error: Bad Request

2 个答案:

答案 0 :(得分:0)

我不是python,但只有我能想到的是你的secret_key末尾有一个空格,我不确定AWS python是否需要ISO日期格式。

尝试使用此便笺簿并检查是否得到相同的结果。

如果您在问题中显示的详细信息是真实的AWS凭据,请将其更改为XXXXXXXXXX

答案 1 :(得分:0)

我找到了答案。 我将marketplace_id作为字符串传递。 正确的方法是将marketplace_id作为列表传递给

marketplaceids = ['A21TJRUUN4KGV',]