0

我被困在 ebay 的 getCateogory api 调用中,下面给出的是一个 django 视图,它在单击按钮时执行,我在 api 调用的后端获得了所需的输出,但它只是返回一个响应,如何在这个 API 调用上获取<ebaysdk.response.Response object at 0x00FC6030>数据print(result)在一个变量中,以便它可以作为上下文传递并可以在前端以所需的格式使用。

基本上,我正在开发一个应用程序来执行 ebay 中的修改操作,因此希望自动填充 ebay 提供的所有下拉列表,例如,项目条件字段应自动填充 ebay 支持和提供的所有有效下拉选项. 这样我就不必在每次 ebay 添加新的商品条件时手动更改它。如果有什么办法,请告诉我。

path = rootpath.detect()
    print(path)
    path = (path + "\\listing\\ebay.yaml")
    api = Connection(config_file=path, domain="api.sandbox.ebay.com", debug=True)
    GetCategoriesRequest = {
            "RequesterCredentials": {
                "eBayAuthToken": "xyz",
            },
            "CategorySiteID": "0",
            "DetailLevel": "ReturnAll",
            "LevelLimit": "1",
    }

    result = api.execute("GetCategories", GetCategoriesRequest)
    print("response of getcategories function is: ")
    print(result)
    print("get Category function worked!")
    ctx = {
        'result': result
    }
    return render(request, 'listing/reviseProduct.html', ctx)
4

1 回答 1

0

要查看 ebay 的 XML 响应的文本,请执行以下操作: print(result.content) 或 print(result.dict()) 将其视为字典。

于 2020-07-12T17:15:04.260 回答