Techiio-author
Started by Jofar ArcharNov 9, 2021

Open
Python Simple Salesforce

3 VIEWES 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 3 VIEWES SHARE

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

Techiio-commentatorMorrison Oak replied 3 months ago0 likes0 dislikes

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

You must be Logged in to reply
Trending Technologies
15
Software40
DevOps47
Frontend Development24
Backend Development20
Server Administration17
Linux Administration26
Data Center24
Sentry24
Terraform23
Ansible83
Docker70
Penetration Testing16
Kubernetes21
NGINX20
JenkinsX17
Recommended Blogs
1
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance