当前位置: 首页>>代码示例>>Python>>正文


Python Connection.response_dom方法代码示例

本文整理汇总了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
开发者ID:HypnoTherapist,项目名称:ebaysdk-python,代码行数:59,代码来源:trading.py


注:本文中的ebaysdk.trading.Connection.response_dom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。