本文整理汇总了Python中ebaysdk.trading.Connection.response_dom方法的典型用法代码示例。如果您正苦于以下问题:Python Connection.response_dom方法的具体用法?Python Connection.response_dom怎么用?Python Connection.response_dom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ebaysdk.trading.Connection
的用法示例。
在下文中一共展示了Connection.response_dom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: verifyAddItemErrorCodes
# 需要导入模块: from ebaysdk.trading import Connection [as 别名]
# 或者: from ebaysdk.trading.Connection import response_dom [as 别名]
def verifyAddItemErrorCodes(opts):
"""http://www.utilities-online.info/xmltojson/#.UXli2it4avc
"""
try:
api = Trading(debug=opts.debug, config_file=opts.yaml, appid=opts.appid,
certid=opts.certid, devid=opts.devid, warnings=False)
myitem = {
"Item": {
"Title": "Harry Potter and the Philosopher's Stone",
"Description": "This is the first book in the Harry Potter series. In excellent condition!",
"PrimaryCategory": {"CategoryID": "377aaaaaa"},
"StartPrice": "1.0",
"CategoryMappingAllowed": "true",
"Country": "US",
"ConditionID": "3000",
"Currency": "USD",
"DispatchTimeMax": "3",
"ListingDuration": "Days_7",
"ListingType": "Chinese",
"PaymentMethods": "PayPal",
"PayPalEmailAddress": "[email protected]",
"PictureDetails": {"PictureURL": "http://i1.sandbox.ebayimg.com/03/i/00/30/07/20_1.JPG?set_id=8800005007"},
"PostalCode": "95125",
"Quantity": "1",
"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": "USPSMedia",
"ShippingServiceCost": "2.50"
}
},
"Site": "US"
}
}
api.execute('VerifyAddItem', myitem)
except ConnectionError as e:
# traverse the DOM to look for error codes
for node in api.response_dom().getElementsByTagName('ErrorCode'):
print("error code: %s" % getNodeText(node))
# check for invalid data - error code 37
if 37 in api.response_codes():
print("Invalid data in request")
print e