我正在尝试发出 getmyebayselling 请求,以便我可以跟踪当前列表的价格和数量。
按照文档和示例 here我生成了一个 token 并尝试向生产 XML 发送请求以查看我当前的列表。
当前尝试:
endpoint = "https://api.ebay.com/ws/api.dll"
xml = """<?xml version="1.0" encoding="utf-8"?>
<GetMyeBaySellingRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>AgAAAA*...full auth token here...wIAYMEFWl</eBayAuthToken>
</RequesterCredentials>
<Version>967</Version>
<ActiveList>
<Sort>TimeLeft</Sort>
<Pagination>
<EntriesPerPage>3</EntriesPerPage>
<PageNumber>1</PageNumber>
</Pagination>
</ActiveList>
</GetMyeBaySellingRequest>"""
headers = {'Content-Type': 'application/xml'}
response = requests.post(endpoint, data=xml, headers=headers)
print response
print response.content
响应:
<?xml version="1.0" encoding="UTF-8" ?><GeteBayOfficialTimeResponse xmlns="urn:ebay:apis:eBLBaseComponents"><Timestamp>2017-04-17 13:01:25</Timestamp><Ack>Failure</Ack><Errors><ShortMessage>Unsupported API call.</ShortMessage><LongMessage>The API call "GeteBayOfficialTime" is invalid or not supported in this release.</LongMessage><ErrorCode>2</ErrorCode><SeverityCode>Error</SeverityCode><ErrorClassification>RequestError</ErrorClassification></Errors><Build>18007282</Build></GeteBayOfficialTimeResponse>
该响应的有用部分:
The API call "GeteBayOfficialTime" is invalid or not supported in this release.
我在这里使用他们自己的文档样本。我能真正看到的唯一时间链接是 <Sort>TimeLeft</Sort>这是一个延伸,但即使没有它,我也会得到同样的回应。
我正在研究不同的 Python 库,试图让 getmyebayselling 请求在没有太多文档的情况下工作。现在通过 eBay 本身的文档,我感觉自己已经死在水里了。如果有人能在正确的方向插入我,我将不胜感激。不确定接下来要尝试什么。
请您参考如下方法:
API 响应错误有点用处不大,但根据您共享的代码判断,您发出的请求缺少必需的 header 字段。更多详情 here
以下更改应该会为您指明正确的方向 -
headers = {
'X-EBAY-API-COMPATIBILITY-LEVEL': '<compat_level>',
'X-EBAY-API-CALL-NAME': '<api_call_name>',
'X-EBAY-API-SITEID': '<api_siteid>',
'Content-Type': 'application/xml'
}
