Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ebay与Python的集成_Python_Django_Python 3.x_Integration_Ebay Sdk - Fatal编程技术网

Ebay与Python的集成

Ebay与Python的集成,python,django,python-3.x,integration,ebay-sdk,Python,Django,Python 3.x,Integration,Ebay Sdk,我必须将我的django项目与Ebay集成。我遵循了SDK存储库,并在开发者论坛上设置了一个帐户,如下所述 我尝试运行以下函数来添加项目 #!/usr/bin/env python3 来自ebaysdk.贸易进口连接 if __name__ == '__main__': api = Connection(config_file="ebay.yaml", domain="api.sandbox.ebay.com", debug=True) request = { "It

我必须将我的django项目与Ebay集成。我遵循了SDK存储库,并在开发者论坛上设置了一个帐户,如下所述

我尝试运行以下函数来添加项目

#!/usr/bin/env python3
来自ebaysdk.贸易进口连接

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:“添加项:类别:RequestError,严重性:Error,代码:120,您需要创建卖家帐户。在您可以列出此项目之前,我们需要一些其他信息来创建卖家帐户。”

020-01-16 17:13:02385 ebaysdk[警告]:附加项:类别:RequestError,严重性:WARNING,代码:21920200,退货政策属性无效退货政策属性returnDescription在此网站上无效


我不知道如何在易趣上设置卖家帐户或退货政策。我从我这边做了很多研发工作,但找不到解决方案。非常感谢您提供的任何帮助。

如果您的凭据有问题,请复制沙盒凭据,如果您想生成身份验证令牌,请转到此url:并生成令牌,如果您想找到沙盒凭据,请访问:如果您是新用户,请登录易趣,这可能需要一周或两天的时间要接受您的帐户并注册,请访问:

易趣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)
#/usr/bin/env蟒蛇3
来自ebaysdk.贸易进口连接
如果uuuu name uuuuuu='\uuuuuuu main\uuuuuuu':
api=连接(config_file=“”,domain=“api.sandbox.ebay.com”,debug=True)
请求={
“项目”:{
“标题”:“专业机械键盘”,
“国家”:“美国”,
“位置”:“它”,
“网站”:“美国”,
“条件ID”:“1000”,
“PaymentMethods”:“PayPal”,
“PayPalEmailAddress”:nobody@gmail.com",
“主要类别”:{“类别ID”:“33963”},
“描述”:“一个非常好的机械键盘!”,
“列表持续时间”:“10天”,
“StartPrice”:“150”,
“货币”:“美元”,
“退货政策”:{
“ReturnsAcceptedOption”:“ReturnsAccepted”,
“退款选项”:“退款”,
“ReturnsWithinOption”:“30天”,
“说明”:“如果您不满意,请退回键盘。”,
“ShippingCostPaidByOption”:“买方”
},
“发货详情”:{
“ShippingServiceOptions”:{
“免费送货”:“正确”,
“发货服务”:“USPSMedia”
}
},
“DispatchTimeMax”:“3”
}
}
d=api.execute(“AddItem”,请求)
印刷品(d)

Ok这不是编码问题。请联系易趣或阅读他们的帮助工具,但此处没有此问题。感谢您的回复。我已经重新检查了我的配置,所有的凭证看起来都很好。正如我在问题中所说,当我试图运行脚本时,我面临的错误与我的请求中的数据不足有关,例如,缺少卖方帐户。如果您帮助我如何设置卖家帐户,这将对我非常有帮助。正如您所说,您的凭据和访问令牌是正确的,那么没有必要设置卖家帐户,请先使用您的沙盒凭据进行测试