尝试使用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())
我在brand
和MPN
上遇到了相同的错误,但是我设法使用ItemSpecifics
和NameValueList
解决了这个错误,但是EAN field
却一无所获。如您所愿,我不会穷尽所有不同的组合,但显然它们不应全部出现在代码中。
这里提出了一些类似的问题:
EBAY API EAN for Variation Listing eBay API call not working for UPC/EAN
但是没有提供有效的有效解决方案,或者至少在我的应用程序中不起作用。