【问题标题】:To get the weight of product in ebay api在 ebay api 中获取产品的重量
【发布时间】:2020-04-10 11:52:29
【问题描述】:

目前我在 ebaysdk 工作。我面临的问题是产品的重量。我怎样才能得到产品重量?我使用了交易 API,但大多数产品的重量等于 0。有没有办法获得每个产品的重量?我是这样要求的:

response = api_trading.execute('GetItem' , 
{"ItemID":"184097524395",'DestinationPostalCode':'2940','DestinationCountryCode':'GB'})

【问题讨论】:

    标签: ebay-api ebay-sdk


    【解决方案1】:

    有些物品的权重包含在“Items Specifications”部分,只能通过在交易api执行中将“IncludeItemSpecifics”设置为“true”来提取:

    response = api_trading.execute('GetItem' , {"ItemID":"254350593466", "IncludeItemSpecifics": "true"})
    

    然后,获取感兴趣的详细信息的一种可能方法是遍历字典:

    for d in response.dict()['Item']['ItemSpecifics']['NameValueList']: 
        print(d)
    

    权重名称和值将在这些字典之一中:

    ...
    {'Name': 'Item Length', 'Value': '1', 'Source': 'ItemSpecific'}
    {'Name': 'Item Weight', 'Value': '2.25', 'Source': 'ItemSpecific'}
    {'Name': 'Item Width', 'Value': '1', 'Source': 'ItemSpecific'}
    ...
    

    来源: https://developer.ebay.com/devzone/guides/features-guide/default.html#development/ItemSpecifics.html

    【讨论】:

    • 你在第二行有一个拼写错误,这让非英语母语的用户感到困惑。
    • 感谢您指出这一点。我现在已经修好了。
    【解决方案2】:

    如果卖家一开始没有注明重量,api就没有什么可显示的了。

    如果免运费,卖家很可能不会费心输入商品的重量。所以也许找那些不包邮的产品,说不定卖家会标明重量来计算运费。

    "ShippingDetails": {"ShippingType": "Calculated"}
    

    我也试过GetItem,只要有重量,它就可以显示物品的重量。我还尝试了 GetItemShipping,它可以显示物品的重量(如果有),但需要 DestinationPostalCode。

    来源:https://github.com/timotheus/ebaysdk-python/issues/304

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-04-19
      • 1970-01-01
      • 1970-01-01
      • 2014-06-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多