Explore Courses Blog Tutorials Interview Questions
0 votes
in Salesforce by (11.9k points)

Is there a library or package which we can use with python to connect to salesforce and get data?

1 Answer

0 votes
by (32.1k points)

To do so, you can use beatbox or stitch.

Look at the following code in Beatbox for lead by email address:

import beatbox

sf_username = "Username"

sf_password = "password"

sf_api_token = "api token"    

def get_lead_records_by_email(email)

    sf_client = beatbox.PythonClient()

    password = str("%s%s" % (sf_password, sf_api_token))

    sf_client.login(sf_username, password)

    lead_qry = "SELECT id, Email, FirstName, LastName, OwnerId FROM Lead WHERE Email = '%s'" % (email)

    records = sf_client.query(lead_qry)

    return records

Browse Categories