无法通过python API登录Salesforce Sandbox

问题描述 投票:0回答:1

我正在使用python3.7.2模块simple-salesforce==0.74.2,我在尝试建立与salesforce沙箱的连接时遇到问题。我可以使用相同的凭据登录到salesforce生产,就像​​这样:

from simple_salesforce import Salesforce
sf = Salesforce(username='[email protected]', password='pswd', security_token='mytoken')

好的很酷。现在我尝试使用以下命令登录我的沙箱:

sf = Salesforce(username='[email protected]_name', password='pswd', security_token='mytoken', sandbox=True)

我收到错误:

simple_salesforce.exceptions.SalesforceAuthenticationFailed:INVALID_LOGIN:用户名,密码,安全令牌无效;或用户被锁定。

所以我尝试使用不同的方法登录:

sf = Salesforce(username='[email protected]_name', password='pswd', security_token='mytoken', domain='sandbox_name')

这给出了一个不同的错误:

requests.exceptions.ConnectionError:HTTPSConnectionPool(host ='sandbox_name.salesforce.com',port = 443):使用url:/services/Soap/u/38.0超出了最大重试次数(由NewConnectionError引起(':无法建立新连接) :[Errno 8] nodename也没提供servname,或者不知道'))

我按照salesforce的说明使用名为sandbox_name的开发人员沙箱。有人可以就我的错误提供一些建议吗?

salesforce sandbox python-3.7 simple-salesforce
1个回答
0
投票

解决了。设置domain='test'并在您的沙箱帐户下生成新令牌

© www.soinside.com 2019 - 2024. All rights reserved.