Пример #1
0
def verifyAddItemErrorCodes(opts):
    """http://www.utilities-online.info/xmltojson/#.UXli2it4avc
    """

    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": "*****@*****.**",
            "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)

    if api.error():

        # traverse the DOM to look for error codes
        for node in api.response_dom().getElementsByTagName("ErrorCode"):
            print("error code: %s" % ebaysdk.nodeText(node))

        # check for invalid data - error code 37
        if 37 in api.response_codes():
            print("Invalid data in request")
Пример #2
0
def verifyAddItemErrorCodes(opts):
    """http://www.utilities-online.info/xmltojson/#.UXli2it4avc
    """

    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": "*****@*****.**",
            "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)

    if api.error():

        # traverse the DOM to look for error codes
        for node in api.response_dom().getElementsByTagName('ErrorCode'):
            print("error code: %s" % ebaysdk.nodeText(node))

        # check for invalid data - error code 37
        if 37 in api.response_codes():
            print("Invalid data in request")
Пример #3
0
def grabValue(el):
	return nodeText(el).encode("utf-8")
Пример #4
0
def grabElementValue(elementname):
	el = item.getElementsByTagName(elementname)[0]
	return nodeText(el).encode("utf-8")
Пример #5
0
def build_display(sep, part):
	el = item.getElementsByTagName(part)[0]
	return nodeText(el).encode("utf-8").strip() + sep
Пример #6
0
def get_item(part):
	el = item.getElementsByTagName(part)[0]
	return nodeText(el).encode("utf-8").strip()