我一直在尝试使用 python ebaysdk,但我无法理解为什么我不断收到以下错误:
{'Timestamp': '2017-02-21T19:55:31.915Z', 'Errors': {'LongMessage': 'Validation of the authentication token in API request failed.', 'ShortMessage': 'Auth token is invalid.', 'SeverityCode': 'Error', 'ErrorCode': '931', 'ErrorClassification': 'RequestError'}, 'Build': 'E989_CORE_API_18131074_R1', 'Version': '989', 'Ack': 'Failure'}
代码片段是从 github repo ( https://github.com/timotheus/ebaysdk-python ) 复制的。
from ebaysdk.trading import Connection as Trading
from ebaysdk.exception import ConnectionError
try:
api = Trading(domain='api.sandbox.ebay.com')
response = api.execute('GetOrders', {})
print(response.dict())
print(response.reply)
except ConnectionError as e:
print(e)
print(e.response.dict())
我还将所有配置都放在了 ebay.yaml 文件中。
要运行代码片段,我会访问 developer.ebay.com,生成用户授权令牌,将其粘贴到 yaml 文件中并运行脚本。
我的脚本的想法是在后台运行。
有使用 ebaysdk 经验的人可以告诉我如何正确连接到交易 API 吗?