python - 亚马逊 MWS GetLowestPricedOffersForSKU 的 Boto 方法

标签 python amazon-web-services boto amazon-mws

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 操作更改为 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 程序员,但在 PHP AmazonMWS API 中,我在下面使用 setMarketplaceId() 的地方使用了代码

$request = new MarketplaceWebServiceProducts_Model_GetLowestPricedOffersForSKURequest();
$request->setSellerId($this->seller_id);
$request->setMarketplaceId($this->marketplace_id);
$request->setItemCondition("New");

关于python - 亚马逊 MWS GetLowestPricedOffersForSKU 的 Boto 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35108032/

相关文章:

python - 无法获取正确的像素颜色图像python

node.js - AWS 的免费层可以在 CentOS 上通过 NodeJS 广播 Twitch 流吗?

python 列表和子列表

python - 是否可以在不使用 django 的身份验证和登录方法的情况下编写登录功能的代码?

Python ctypes : Prototype with LPCSTR [out] parameter

Django + S3 (boto) + Sorl 缩略图 : Suggestions for optimisation

python - 如何在 Python 3 上将文件上传到 Google Cloud Storage?

amazon-web-services - 嵌套堆栈和构造之间的权衡是什么?

amazon-web-services - 域 + AWS EC2 : How to make www. mydomain.com 指向我的 EC2 服务器吗?

amazon-web-services - 如何限制对特定前缀中的 S3 key 的访问? (在 Python/boto 中)