eBay API“错误,代码:21919301,缺少EAN字段。缺少EAN字段。请将EAN添加到列表中,然后重试。”

时间:2018-08-10 21:11:17

标签: python python-3.x ebay ebay-api

尝试使用ebaysdk-python列出项目时出现以下错误:

error, Code: 21919301, The EAN field is missing. The EAN field is missing. Please add EAN to the listing and try again.

这是完整的代码:

from ebaysdk.trading import Connection as Trading
from ebaysdk.exception import ConnectionError

try:    
    #api = Trading(domain='api.sandbox.ebay.com', config_file='ebay.yaml')
    api = Trading(domain='api.ebay.com', config_file='ebay.yaml',debug=True)
    response = api.execute('GetUser', {})
    #print(response.dict())
    #print(response.reply)

    myitem = {
        "Item": {
            "Title": "BO BeoPlay A2 ",
            "Description": "balalalla",
            "PrimaryCategory": {"CategoryID": "111694"},
            "ItemSpecifics": {
                "NameValueList": [
                   {"Name": "Brand",
                   "Value": "TEST"},
                   {"Name": "MPN",
                   "Value": "aldskjfalkjdsf"},
                   {"Name": "UPC",
                 "Value": "5705260060331"},
                   {"Name": "EAN",
                 "Value": "5705260060331"},
                    ]              
                  },

        "Variation":{
            "Variation":{
            "VariationProductListingDetails": {
                "EAN": "5705260060331", 
                    "NameValueList": [
                    {"Name": "EAN",
                    "Value": "5705260060331"},
                    {"Name": "UPC",
                    "Value": "5705260060331"},
                    ]
              },
            },
            },

        "ProductListingDetails": {
            "EAN": "5705260060331", 
                "NameValueList": [
                {"Name": "EAN",
                "Value": "5705260060331"},
                                    {"Name": "UPC",
                "Value": "5705260060331"},
                ]
          },

            "StartPrice": "1000.0",
            "CategoryMappingAllowed": "true",
            "Country": "GB",
            "ConditionID": "1000",
            "Currency": "GBP",
            "DispatchTimeMax": "1",
            "ListingDuration": "Days_7",
            "ListingType": "FixedPriceItem",
            "PaymentMethods": "PayPal",
            "PayPalEmailAddress": "alexbowles@gmail.com",
            "PictureDetails": {"PictureURL": "http://i1.sandbox.ebayimg.com/03/i/00/30/07/20_1.JPG?set_id=8800005007"},
            "PostalCode": "UB70JD",
            "Quantity": "1",

            "EAN": "5705260060331",

            "ReturnPolicy": {
                "ReturnsAcceptedOption": "ReturnsAccepted",
                "RefundOption": "MoneyBack",
                "ReturnsWithinOption": "Days_30",
                "Description": "If you are not satisfied, return the book for refund.",
                "ShippingCostPaidByOption": "Buyer"
            },
            "ShippingDetails": {
                "ShippingType": "Flat",
                "ShippingServiceOptions": {
                    "ShippingServicePriority": "1",
                    "ShippingService": "UK_RoyalMailFirstClassStandard",
                    "ShippingServiceCost": "2.50"
                }
            },
            "Site": "UK"
        }
    }

    api.execute('VerifyAddItem', myitem)
    dump(api)

except ConnectionError as e:
    print(e)
    print(e.response.dict())

我在brandMPN上遇到了相同的错误,但是我设法使用ItemSpecificsNameValueList解决了这个错误,但是EAN field却一无所获。如您所愿,我不会穷尽所有不同的组合,但显然它们不应全部出现在代码中。

这里提出了一些类似的问题:

EBAY API EAN for Variation Listing eBay API call not working for UPC/EAN

但是没有提供有效的有效解决方案,或者至少在我的应用程序中不起作用。

0 个答案:

没有答案