Python脚本返回模式XML请求错误SimpleDeserializer

Python脚本返回模式XML请求错误SimpleDeserializer,python,ebay-sdk,Python,Ebay Sdk,我正在尝试使用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=op

我正在尝试使用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'}

从我读到的内容来看,这听起来可能是我代码中的某个语法错误,但我找不到任何问题。我是否可以执行任何程序或实用程序来查找可能的语法问题?

有许多编码程序、编辑器、IDE等来帮助查找语法问题——询问这些问题的最佳地方可能是。您可能应该根据易趣的模式验证JSON有效负载,看看您是否做得对。