python salesforce library to get salesforce data

Published on Author Code Father

Use beatbox

Example to query for a 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

To get other data look at the salesforce api docs

view other beatbox examples here

Comments

comments