I'm seeking to use simple_salesforce to question salesforce records with python. I am the usage of my username and password, which I am one hundred% certain is correct. I got the org identification from logging into salesforce and looking at my agency profile. It is only a fifteen-digit identification. I am specifically using an orchid to keep away from using a protection token as I don't know what it's far from. What am I doing wrong?
Code:
from simple_salesforce import Salesforce
sf = Salesforce(instance_url='https://na1.salesforce.com', session_id='')
sf = Salesforce(password='password', username='email', organizationId='15 digit org id')
Output:
File "C:\Python27\lib\site-packages\simple_salesforce\api.py", line 100, in __init__
proxies=self.proxies)
File "C:\Python27\lib\site-packages\simple_salesforce\login.py", line 124, in SalesforceLogin
code=except_code, message=except_msg))
simple_salesforce.login.SalesforceAuthenticationFailed: INVALID_LOGIN: Invalid username, password, security token; or user locked out.
1 Replies
I wrote most of simple-salesforce (although not the organization part, as I don't have an IP-whitelisted account to test against)
The standard/vanilla/regular/99% of users should use version is the simple username, password, security_token method.
So something like this
from simple_salesforce import Salesforce
sf = Salesforce(username='nick@nickcatalano.com', password='nickspassword', security_token='tokenemailedtonick')
By far the most confusing part is the security_token part (and was the part I got snagged with.) It turns out the Security Token is emailed to you after a successful password reset. So if you go into your salesforce account and reset your password, I believe you'll end up with an email with the subject salesforce.com security token confirmation which will contain a Security Token in the email. That's your security_token.
To be honest, the security_token kwarg is more convenient than anything. In the normal email/password/token flow that most users rely on what is being sent is email as the login and {password}{security_token} as the password. I believe you could concat that yourself and just pass in an email and password kwarg if you want, but I figured forcing people to concat the password and token themselves would get-go against the simple part of simple-salesforce