0

我必须将我的 django 项目与 Ebay 集成。我已关注 SDK 存储库并在此处指定的开发人员论坛上设置了一个帐户 Ebay SDK Repository for Python

我试图运行以下函数来添加一个项目

#!/usr/bin/env python3

从 ebaysdk.trading 导入连接

if __name__ == '__main__':
    api = Connection(config_file="ebay.yaml", domain="api.sandbox.ebay.com", debug=True)
    request = {
    "Item": {
        "Title": "Professional Mechanical Keyboard",
        "Country": "US",
        "Location": "IT",
        "Site": "US",
        "ConditionID": "1000",
        "PaymentMethods": "PayPal",
        "PayPalEmailAddress": "nobody@gmail.com",
        "PrimaryCategory": {"CategoryID": "33963"},
        "Description": "A really nice mechanical keyboard!",
        "ListingDuration": "Days_10",
        "StartPrice": "150",
        "Currency": "USD",
        "ReturnPolicy": {
            "ReturnsAcceptedOption": "ReturnsAccepted",
            "RefundOption": "MoneyBack",
            "ReturnsWithinOption": "Days_30",
            "Description": "If you are not satisfied, return the keyboard.",
            "ShippingCostPaidByOption": "Buyer"
        },
        "ShippingDetails": {
            "ShippingServiceOptions": {
                "FreeShipping": "True",
                "ShippingService": "USPSMedia"
            }
        },
        "DispatchTimeMax": "3"
    }
}

api.execute("AddItem", request)

但后来我遇到了以下错误

ebaysdk.exception.ConnectionError: "AddItem: Class: RequestError, Severity: Error, Code: 120, You need to create a Seller's account. 在你列出这个项目之前,我们需要一些额外的信息来创建一个卖家账户。"

020-01-16 17:13:02,385 ebaysdk [警告]:AddItem:类:RequestError,严重性:警告,代码:21920200,退货政策属性无效退货政策属性 returnDescription 在本网站上无效

我不知道如何在 Ebay 上设置卖家账户或退货政策。我从我身边做了很多研发,但找不到解决方案。对此的任何帮助将不胜感激。

4

1 回答 1

1

您的凭据有问题,请复制沙盒凭据,如果您想生成身份验证令牌,请转到此网址:https ://developer.ebay.com/DevZone/build-test/test-tool/?index=0和生成令牌,如果您想找到您的沙盒凭据,请访问:https ://developer.ebay.com/my/keys如果您是新用户,请注册 ebay,可能需要 1 周或 2 天才能接受您的帐户和注册请访问:https ://developer.ebay.com/signin

ebay-yaml 文件:

name: ebay_api_config

# Trading API Sandbox - https://www.x.com/developers/ebay/products/trading-api
api.sandbox.ebay.com:
    compatability: 719
    appid: ENTER_YOUR_APPID_HERE
    certid: ENTER_YOUR_CERTID_HERE
    devid: ENTER_YOUR_DEVID_HERE
    token: ENTER_YOUR_TOKEN_HERE

# Trading API - https://www.x.com/developers/ebay/products/trading-api
api.ebay.com:
    compatability: 719
    appid: ENTER_YOUR_APPID_HERE
    certid: ENTER_YOUR_CERTID_HERE
    devid: ENTER_YOUR_DEVID_HERE
    token: ENTER_YOUR_TOKEN_HERE

# Finding API - https://www.x.com/developers/ebay/products/finding-api
svcs.ebay.com:
    appid: ENTER_YOUR_APPID_HERE
    version: 1.0.0

# Shopping API - https://www.x.com/developers/ebay/products/shopping-api
open.api.ebay.com:
    appid: ENTER_YOUR_APPID_HERE
    version: 671

附加代码:

#!/usr/bin/env python3
from ebaysdk.trading import Connection

if __name__ == '__main__':
    api = Connection(config_file="<your-yaml-file-path>", domain="api.sandbox.ebay.com", debug=True)
    request = {
        "Item": {
            "Title": "Professional Mechanical Keyboard",
            "Country": "US",
            "Location": "IT",
            "Site": "US",
            "ConditionID": "1000",
            "PaymentMethods": "PayPal",
            "PayPalEmailAddress": "nobody@gmail.com",
            "PrimaryCategory": {"CategoryID": "33963"},
            "Description": "A really nice mechanical keyboard!",
            "ListingDuration": "Days_10",
            "StartPrice": "150",
            "Currency": "USD",
            "ReturnPolicy": {
                "ReturnsAcceptedOption": "ReturnsAccepted",
                "RefundOption": "MoneyBack",
                "ReturnsWithinOption": "Days_30",
                "Description": "If you are not satisfied, return the keyboard.",
                "ShippingCostPaidByOption": "Buyer"
            },
            "ShippingDetails": {
                "ShippingServiceOptions": {
                    "FreeShipping": "True",
                    "ShippingService": "USPSMedia"
                }
            },
            "DispatchTimeMax": "3"
        }
    }
    d=api.execute("AddItem", request)
    print(d)
于 2020-01-16T13:12:05.123 回答