我想弄清楚如何使用boto来获取各种Amazon卖家帐户数据。然而,我似乎找不到任何与此相关的例子。 下面的代码不返回错误,但也不返回任何有用的数据(除了注释掉的print orders行,它似乎返回了有用的数据)。在
from boto.mws.connection import MWSConnection
merchantId = 'zzzz'
marketplaceId = 'zzz'
accessKeyId = 'zzzz'
secretKey = 'secret'
mws = MWSConnection(accessKeyId, secretKey, Merchant=merchantId)
orders = mws.list_orders(CreatedAfter='2015-10-23T12:00:00Z', MarketplaceId =
[marketplaceId])
#print orders
theData = mws.get_order(AmazonOrderId='xxx-xxxxxx-xxxxx')
print theData
有没有关于如何获得上述特定订单相关数据的提示?在
您的
orders
变量看起来不错,这就是打印显示数据的原因,但可能很难理解。据我所见,boto创建自定义对象,这些对象是从web响应中翻译出来的。最有用的文档是Amazon MWS Dev Guide和{a2}。如果你仔细看,你会发现所有的方法都是合二为一的。在代码的问题在于,
list_orders
请求返回一个订单列表。您需要解析列表以获得每个订单的ID。由于get_order
方法已返回order info,因此get_order
调用是多余的。在虽然下面的代码应该没有测试过。在
相关问题 更多 >
编程相关推荐