上传商品时出现 API ebaysdk 交易错误 2191930

发布于 2025-01-15 08:18:57 字数 3498 浏览 4 评论 0原文

几天来,我在交易方面一直在使用 eBay 的 API 时遇到问题(我几乎完全参考了 本文)。我想上传一个示例项目(摘自 timotheus 交易module)到沙箱,但我的小程序报告以下错误:

ebaysdk.exception.ConnectionError:'AddItem:类:RequestError,严重性:错误,代码:21919303,缺少项目特定的书名\xa0。缺少项目特定的书名\xa0。\xa0将书名添加到此列表,输入有效值,然后重试。,类别:RequestError,严重性:错误,代码:21919303,缺少项目特定的作者\xa0。缺少项目特定的作者\xa0。\xa0将作者添加到此列表,输入有效值,然后重试。,类别:RequestError,严重性:错误,代码:21919303,缺少项目特定的语言\xa0。缺少项目特定语言\xa0。\xa0将语言添加到此列表,输入有效值,然后重试。'

执行的代码如下:

from ebaysdk.trading import Connection

if __name__ == '__main__':
    api = Connection(config_file="ebay.yaml", domain="api.sandbox.ebay.com", debug=True)
    request = {
        "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": "377"},
            "StartPrice": "10.0",
            "BuyItNowPrice": "15.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"
            },
            "SellerProfiles": {
                "SellerPaymentProfile": {
                    "PaymentProfileName": "PayPal:Immediate pay",
                },
                "SellerReturnProfile": {
                    "ReturnProfileName": "30 Day Return Policy",
                },
                "SellerShippingProfile": {
                    "ShippingProfileName": "USPS First Class, Priority, Priority Express Flat Rate Envelope",
                }
            },
            "ShippingDetails": {
                "ShippingType": "Calculated",
                "ShippingServiceOptions": {
                    "ShippingServicePriority": "1",
                    "ShippingService": "USPSMedia"
                },
                "CalculatedShippingRate": {
                    "OriginatingPostalCode": "95125",
                    "PackagingHandlingCosts": "0.0",
                    "ShippingPackage": "PackageThickEnvelope",
                    "WeightMajor": "1",
                    "WeightMinor": "0"
                }
            },
            "Site": "US"
        }
    }

    api.execute("AddItem", request)

我尝试试探性地添加错误报告的功能,但收效甚微。

我的目标是在未来创建一个允许在 eBay 上自动加载商品的应用程序,因为我有许多具有几乎相同特征的二手商品可供出售。尽管eBay api python sdk 文档不好/差,但我希望能够成功。

提前致谢。

I've been having trouble with eBay's API for days when it comes to trading (I drew almost entirely on the tutorial of this article). I would like to upload a sample item (extracted from the timotheus trading module) to the Sandbox but my little program reports the following error:

ebaysdk.exception.ConnectionError: 'AddItem: Class: RequestError, Severity: Error, Code: 21919303, The item specific Book Title\xa0is missing. The item specific Book Title\xa0is missing.\xa0Add Book Title to this listing, enter a valid value, and then try again., Class: RequestError, Severity: Error, Code: 21919303, The item specific Author\xa0is missing. The item specific Author\xa0is missing.\xa0Add Author to this listing, enter a valid value, and then try again., Class: RequestError, Severity: Error, Code: 21919303, The item specific Language\xa0is missing. The item specific Language\xa0is missing.\xa0Add Language to this listing, enter a valid value, and then try again.'

The code executed is the following:

from ebaysdk.trading import Connection

if __name__ == '__main__':
    api = Connection(config_file="ebay.yaml", domain="api.sandbox.ebay.com", debug=True)
    request = {
        "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": "377"},
            "StartPrice": "10.0",
            "BuyItNowPrice": "15.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"
            },
            "SellerProfiles": {
                "SellerPaymentProfile": {
                    "PaymentProfileName": "PayPal:Immediate pay",
                },
                "SellerReturnProfile": {
                    "ReturnProfileName": "30 Day Return Policy",
                },
                "SellerShippingProfile": {
                    "ShippingProfileName": "USPS First Class, Priority, Priority Express Flat Rate Envelope",
                }
            },
            "ShippingDetails": {
                "ShippingType": "Calculated",
                "ShippingServiceOptions": {
                    "ShippingServicePriority": "1",
                    "ShippingService": "USPSMedia"
                },
                "CalculatedShippingRate": {
                    "OriginatingPostalCode": "95125",
                    "PackagingHandlingCosts": "0.0",
                    "ShippingPackage": "PackageThickEnvelope",
                    "WeightMajor": "1",
                    "WeightMinor": "0"
                }
            },
            "Site": "US"
        }
    }

    api.execute("AddItem", request)

I tried to heuristically add the features reported by the error but with little success.

My goal is to create in the future an application that allows the automatic loading of items on eBay, since I have many second-hand items to sell with almost identical characteristics. I hope to succeed despite the bad/poor eBay api python sdk documentation.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼趣 2025-01-22 08:18:57

来自官方 eBay 文档/样本,如果您查看“示例:基本调用”,您会看到一个 标记,位于 QuantityReturnPolicy 之间。因为您缺少该标签,所以您会收到错误。

添加与此标签类似的字典/属性来解决问题。

    <ItemSpecifics>
       <NameValueList>
          <Name>Title</Name>
          <Value>Harry Potter and the Philosophers Stone</Value>
       </NameValueList>
       <NameValueList>
          <Name>Publisher</Name>
          <Value>Smashwords</Value>
       </NameValueList>
       <NameValueList>
          <Name>Author</Name>
          <Value>JK Rowling</Value>
       </NameValueList>
       <NameValueList>
          <Name>Language</Name>
          <Value>English</Value>
       </NameValueList>
    </ItemSpecifics>

From the offical eBay docs/samples, if you look at "Sample: Basic Call", you'll see a tag, placed between Quantity and ReturnPolicy. Sine you're missing that tag, you're getting the error.

Add a dict/attribute similar to this tag to fix the issue.

    <ItemSpecifics>
       <NameValueList>
          <Name>Title</Name>
          <Value>Harry Potter and the Philosophers Stone</Value>
       </NameValueList>
       <NameValueList>
          <Name>Publisher</Name>
          <Value>Smashwords</Value>
       </NameValueList>
       <NameValueList>
          <Name>Author</Name>
          <Value>JK Rowling</Value>
       </NameValueList>
       <NameValueList>
          <Name>Language</Name>
          <Value>English</Value>
       </NameValueList>
    </ItemSpecifics>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文