我正在尝试使用ebaysdk为python构建AddItem函数,并且在使事情正常工作时遇到一些问题。
这是我正在调用的python代码:
def addItem(opts):
try:
api = Trading(domain=opts.domain, debug=opts.debug, config_file=opts.yaml, appid=opts.appid,
certid=opts.certid, devid=opts.devid, warnings=False)
myitem = {
"Item": {
"Title": "Martin Landau AUTOGRAPH - 2016 Leaf POP Century",
"Description": "You are bidding on an autographed Martin Landau card from 2016 Lead POP Century!",
"PrimaryCategory": {"CategoryID": "183050"},
"StartPrice": ".99",
"CategoryMappingAllowed": "true",
"Country": "US",
"ConditionID": "3000",
"Currency": "USD",
"DispatchTimeMax": "3",
"ListingDuration": "Days_7",
"ListingType": "Chinese",
"PaymentMethods": "PayPal",
"PayPalEmailAddress": "email@here",
"PictureDetails": {
"GalleryType": "Gallery",
"PictureURL": [
"https://i.ebayimg.com/xxxxxxxxx/$_1.JPG?set_id=2",
"https://i.ebayimg.com/xxxxxxxxxx/$_1.JPG?set_id=2"
],
"GalleryURL": "https://i.ebayimg.com/xxxxxxxx/$_1.JPG?set_id=2"
},
"PostalCode": "34638",
"Quantity": "1",
"ReturnPolicy": {
"ReturnsAcceptedOption": "ReturnsNotAccepted"
},
"ShippingDetails": {
"ShippingDiscountProfileID": "0",
"InternationalShippingDiscountProfileID": "0",
"ShippingServiceOptions": {
"ShippingServicePriority": "1",
"ShippingTimeMin": "2",
"ExpeditedService": "false",
"ShippingService": "USPSFirstClass",
"ShippingTimeMax": "3"
},
"GlobalShipping": "true",
"CalculatedShippingRate": {
"ShippingIrregular": "false",
"PackagingHandlingCosts": {
"_currencyID": "USD",
"value": "0.0"
},
"PackageDepth": {
"_unit": "inches",
"_measurementSystem": "English",
"value": "1"
},
"WeightMajor": {
"_unit": "lbs",
"_measurementSystem": "English",
"value": "1"
},
"WeightMinor": {
"_unit": "oz",
"_measurementSystem": "English",
"value": "0"
},
"ShippingPackage": "PackageThickEnvelope",
"OriginatingPostalCode": "34638",
"PackageWidth": {
"_unit": "inches",
"_measurementSystem": "English",
"value": "5"
},
"PackageLength": {
"_unit": "inches",
"_measurementSystem": "English",
"value": "8"
},
"InternationalPackagingHandlingCosts": {
"_currencyID": "USD",
"value": "0.0"
}
}
},
"Site": "US"
}
}
api.execute('AddItem', myitem)
dump(api)
except ConnectionError as e:
print(e)
print(e.response.dict())
当我尝试运行时,出现此错误:
u'AddItem: Class: RequestError, Severity: Error, Code: 20170, Schema XML request error. Schema XML request error: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize..'
{'Ack': 'Failure', 'Timestamp': '2018-07-21T04:12:36.891Z', 'Errors': {'SeverityCode': 'Error', 'ErrorClassification': 'RequestError', 'ErrorCode': '20170', 'LongMessage': 'Schema XML request error: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize..', 'ErrorParameters': {'_ParamID': '0', 'Value': 'SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.'}, 'ShortMessage': 'Schema XML request error.'}, 'Version': '1069', 'Build': 'E1069_UNI_API5_18749601_R1'}
从我读到的内容来看,这听起来似乎是我的代码中的语法错误,但是我找不到任何问题。我可以执行任何程序或实用程序来查找可能的语法问题吗?