我正在尝试通过交易API访问英国eBay沙盒上的测试用户。我已经为测试用户帐户设置了应用程序密钥和授权令牌。
我已经在API调用中明确设置了“域”字段,因为默认域是eBay美国主页。
from ebaysdk.trading import Connection as Trading
from ebaysdk.exception import ConnectionError
myAppId = 'fake appID'
myDevId = 'fake dev ID'
myCertId = 'a fake Cert ID'
username = 'fakeuser'
authToken = 'a very long alphanumeric string'
try:
api = Trading(domain = 'api.sandbox.ebay.co.uk', config_file=None, appid=myAppId, devid=myDevId, certid=myCertId, token=authToken)
except ConnectionError as e:
print(e)
print(e.response.dict())
在此代码的第一次运行中,我得到一个错误:
HTTPSConnectionPool(host='api.sandbox.ebay.co.uk', port=443): Max retries exceeded
with url: /ws/api.dll (Caused by NewConnectionError
('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object
at 0x0000021EABBDC5C0>: Failed to establish a new connection: [WinError 10061]
No connection could be made because the target machine actively refused it',))
我已经成功地使用相同的代码(具有不同的域)在eBay UK主站点API上访问普通用户的数据。
由于这是首次访问UK沙箱API,因此我看不到超过最大重试次数会导致该错误。
我的代码或方法有什么错误?