【发布时间】:2016-05-08 13:49:31
【问题描述】:
Boto 提供对大多数亚马逊 MWS API 的访问,但不适用于 GetLowestPricedOffersForSKU。我试图破解一个,但它会产生一个Invalid MarketplaceId 错误。
Boto 有一个结构非常相似的 API 的代码——GetLowestOfferListingsForSKU:
@requires(['MarketplaceId', 'SellerSKUList'])
@structured_lists('SellerSKUList.SellerSKU')
@api_action('Products', 20, 5, 'GetLowestOfferListingsForSKU')
def get_lowest_offer_listings_for_sku(self, request, response, **kw):
"""Returns the lowest price offer listings for a specific
product by item condition and SellerSKUs.
"""
return self._post_request(request, kw, response)
所以我修改了@api_action,将MWS Operation改为GetLowestPricedOffersForSKU:
### MINE ###
@requires(['MarketplaceId', 'SellerSKUList'])
@structured_lists('SellerSKUList.SellerSKU')
@api_action('Products', 20, 5, 'GetLowestPricedOffersForSKU')
def get_lowest_priced_offers_for_sku(self, request, response, **kw):
return self._post_request(request, kw, response)
我这样称呼这个方法:
conn = connection.MWSConnection(
aws_access_key_id=ACCESS_KEY,
aws_secret_access_key=SECRET_KEY,
Merchant=ACCOUNT_ID
)
response = conn.get_lowest_priced_offers_for_sku(
MarketplaceId=marketplace_id, SellerSKUList=sku_list, ItemCondition=condition
)
当我调用get_lowest_priced_offers_for_sku 时,我收到Invalid MarketplaceId 错误。如果我所做的唯一更改是调用get_lowest_offer_listings_for_sku——让每个变量都相同——代码可以找到并返回一个有效的响应对象。这工作得很好:
response = conn.get_lowest_offer_listings_for_sku(
MarketplaceId=marketplace_id, SellerSKUList=sku_list, ItemCondition=condition
)
我需要做什么才能通过 boto 访问亚马逊 MWS GetLowestPricedOffersForSKU?
【问题讨论】:
标签: python amazon-web-services boto amazon-mws