django - XML 向亚马逊 MWS 提交得很好,但价格没有更新

标签 django python-3.x amazon-mws

我创建了自己的各种重新定价器,但亚马逊方面并未更新价格。

根据亚马逊在提交后的响应,我的代码似乎工作得很好。我希望这里有人更了解为什么它实际上没有更新价格。

这是提交的 XML:

<?xml version="1.0" encoding="utf-8" ?>
<AmazonEnvelope
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
    <Header>
        <DocumentVersion>1.01</DocumentVersion>
        <MerchantIdentifier>MERCHANTID</MerchantIdentifier>
    </Header>
    <MessageType>Price</MessageType>
    <Message>
        <MessageID>1</MessageID>
        <Price>
            <SKU>mysku</SKU>
            <StandardPrice currency="USD">350.50</StandardPrice>
        </Price>
    </Message>
</AmazonEnvelope>

以下是回应:
GetFeedSubmissionResultResponse{}(ResponseMetadata: <Element_?/ResponseMetadata_0x7fee61f74248>, GetFeedSubmissionResultResult: <Element_?/GetFeedSubmissionResultResult_0x7fee61f74248>, AmazonEnvelope: 
{'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:noNamespaceSchemaLocation': 'amzn-envelope.xsd'}, DocumentVersion: '1.02', MerchantIdentifier: 'M_EXAMPLE_1234', Header: '\n\t', MessageType: 'ProcessingReport', MessageID: '1', DocumentTransactionID: '4200000000', StatusCode: 'Complete', MessagesProcessed: '1', MessagesSuccessful: '1', MessagesWithError: '0', MessagesWithWarning: '0', ProcessingSummary: '\n\t\t\t', ProcessingReport: '\n\t\t', Message: '\n\t')

我不知道在这种情况下显示我的代码是否会有所帮助,因为我收到了亚马逊的成功回复。这里不管:
...

# Provide credentials.
conn = MWSConnection(
    aws_access_key_id=AWS_ACCESS_KEY_ID,
    aws_secret_access_key=AWS_SECRET_ACCESS_KEY,
    Merchant=AMZ_SELLER_ID
)

# Get the service resource
sqs = boto3.resource('sqs')

# Get the queue
queue = sqs.get_queue_by_name(QueueName=SQS_QUEUE_NAME)

for index, message in enumerate(queue.receive_messages(MaxNumberOfMessages=10)):

    ...

    import time
    from jinja2 import Environment, PackageLoader

    env = Environment(loader=PackageLoader('repricer', 'xml_templates'), trim_blocks=True, lstrip_blocks=True)
    template = env.get_template('_POST_PRODUCT_PRICING_DATA_.xml')

    class Message(object):
        def __init__(self, s, price):
            self.SKU = s
            self.PRICE = round(price, 2)
            self.CURRENCY = USD_CURRENCY

    feed_messages = [
        Message(sku.sku, new_price),
    ]

    namespace = dict(MerchantId=AMZ_SELLER_ID, FeedMessages=feed_messages)
    feed_content = template.render(namespace).encode('utf-8')

    print(feed_content)

    feed = conn.submit_feed(
        FeedType='_POST_PRODUCT_PRICING_DATA_',
        PurgeAndReplace=False,
        MarketplaceIdList=[MARKETPLACE_ID],
        content_type='text/xml',
        FeedContent=feed_content
    )

    feed_info = feed.SubmitFeedResult.FeedSubmissionInfo
    print('Submitted product feed: ' + str(feed_info))

    while True:
        submission_list = conn.get_feed_submission_list(
            FeedSubmissionIdList=[feed_info.FeedSubmissionId]
        )
        info = submission_list.GetFeedSubmissionListResult.FeedSubmissionInfo[0]
        submission_id = info.FeedSubmissionId
        status = info.FeedProcessingStatus
        print('Submission Id: {}. Current status: {}'.format(submission_id, status))

        if status in ('_SUBMITTED_', '_IN_PROGRESS_', '_UNCONFIRMED_'):
            print('Sleeping and check again....')
            time.sleep(60)
        elif status == '_DONE_':
            feedResult = conn.get_feed_submission_result(FeedSubmissionId=submission_id)
            print(feedResult)
            break
        else:
            print("Submission processing error. Quit.")
            break

最佳答案

有几个可能的原因,大致按可能性的顺序列出:

1. 亚马逊更新值(value)的速度比他们说的要慢。有可能虽然提要成功了,但在该更改反射(reflect)在亚马逊上之前还有一段时间(即使来自 SellerCentral 的更改值也会附带一条消息,表明它不是即时的)。
等待几分钟,看看更改最终是否会出现。

2. 您可以拥有一个仍处于事件状态的备用重新定价服务。如果您当前正在为此 SKU 使用另一个重新定价器,它可能会与您的尝试竞争并根据其自己的规则集恢复价格。
可以使用 GetFeedSubmissionList 调用来查看是否有另一个 _POST_PRODUCT_PRICING_DATA_提要是在您之后提交的(尽管无法查看提交的内容)。

3. SKU 上的最低和最高价格可能存在冲突(无论您是否设置),并且您尝试设置的价格超出了允许范围。这是亚马逊的一项政策要求新的和更新的 SKU 设置这些或使用默认标准的结果。

In our continued effort to reduce price error risks to sellers and to avoid potentially negative customer experiences, starting on January 14, 2015, you will not be able to use your Seller Central preferences to select a blanket “opt-out” from all potential low- and high-pricing error rules. Instead, you will need to set a minimum and maximum allowed selling price for each product in your inventory if you do not want Amazon’s default potential pricing error rules to apply to that product.



我在这上面找不到公告页面,所以它可能是一封电子邮件,但它在 forums 上被引用了。

在这些情况下,Feed 将报告成功(因为其引用/格式是正确的),但由于设置的价格范围限制,价格更改将无声地失败。
您可以通过查看 SellerCentral Manage Inventory 页面下的 SKU 来验证这是否是您的问题。您可能需要打开最小/最大列以查看当前值,具体取决于您为该页面设置的首选项。

不幸的是,没有办法拉出库存元素的最低/最高价格来提前知道这是否会成为一个问题:

Dear Seller,

I am Sharon from Amazon Seller Support and I will be assisting you with your concern today.
From the content of your email, I understand that you are concerned if there's any report where you can download the report for 'Minimum Price' and 'Maximum Price'.
I regret to inform you that as of now the reports which are available will only provide information for 'standard_price' and 'list_price'.
I understand that this is a disappointment for you but please understand that as of not this feature of including 'Minimum Price' and 'Maximum Price' in the inventory reports has not been included and I sincerely apologize for all the inconvenience caused to you in this regard.



通过亚马逊 MWS 团队的支持票,2016 年 7 月 3 日

4. 亚马逊可能不允许 Feed 在事件促销期间更新价格。您应该能够通过查看 SellerCentral Manage Inventory 页面来检查某件商品是否在售,其中“价格”列将以绿色边框显示。
似乎不太可能,因为他们要求“Sale”元素提供“StandardPrice”元素,但亚马逊自己的“自动定价”工具将其列为 possible reason对于工具失败。

5. 您正在将价格更新应用到错误的市场。
如果提供给 MarketplaceIdList=[MARKETPLACE_ID], 下的调用的 id是针对与您正在检查的市场不同的市场,您不会看到价格变化。
如果您提交到您无权访问的市场,亚马逊确实无法通过 Feed 提交请求,因此如果您只有一个市场,这可能不是问题。

6. 您正在错误的位置寻找新价格。
如果您在 SellerCentral Manage Inventory 页面下查看,请确保您查看的是“价格”列而不是“最低价格”列。
如果您正在查看产品的详细信息或优惠页面(在亚马逊店面),请确保您正在查看您的优惠。您可能不是详细信息页面上显示的主要报价或报价列表页面上显示的最高报价。
当然,请确保您拥有正确的 SKU/ASIN。

7. 这是针对不同的提要,而是 user has reported亚马逊有时只是不更新​​信息,需要重新发送提要。

您可以尝试使用替代提要来更新价格信息 _POST_FLAT_FILE_INVLOADER_DATA_ ,但它是一种平面文件类型(制表符分隔),因此您的 XML 架构不会转移。如果您认为问题与您使用的特定提要有关,则可能只值得尝试。

关于django - XML 向亚马逊 MWS 提交得很好,但价格没有更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46125855/

相关文章:

python - 为数据库中现有条目生成 slug 字段数据

python - 使用 Parler 在 Django 管理界面中创建自定义表单

python - self.assertRaises 作为上下文管理器,msg 参数未按预期工作

javascript - 在不根据 Django 管理站点检查用户的情况下登录 Django 网站

json - JSONRenderer无法序列化:b'{“id”:“11122211133311”}}不可JSON序列化

c# - 使用 c# 的亚马逊市场网络服务 (amazon mws)

php - 亚马逊 MWS (PHP) - 请求如何工作

amazon-mws - MWS 或 'Product Advertising API' 如何判断产品是否为 'Add-on-Item'

python-3.x - Snakemake - 如何使用文件的每一行作为输入?

python - Windows 上 Python 控制台中的进度条