{#- Home page: a hero (follows the light/dark toggle) above a short landing section. -#} {% extends "main.html" %} {% block extrahead %} {{ super() }} {% endblock %} {% block hero %}

even-simpler-salesforce

The Salesforce client your web app deserves. Async or sync, same API.

{#- One window; the radios drive the Async / Sync tabs in its bar. -#}
import even_simpler_salesforce as esf

auth = esf.ClientCredentials(
    domain="https://acme.my.salesforce.com",
    client_id=CLIENT_ID,
    client_secret=CLIENT_SECRET,
)

# Logs in on the first call. Refreshes the token for you.
async with esf.AsyncSalesforce(auth) as sf:
    # Values are quoted for you: no SOQL injection.
    lead = await sf.query_one(
        "SELECT Id, Name FROM Lead WHERE Email = {}", email
    )

    try:
        await sf.sobject("Lead").update(lead["Id"], {"Status": "Working"})
    except esf.ValidationRuleFailed as exc:
        print(exc.message, exc.fields)  # one class per Salesforce error
import even_simpler_salesforce as esf

auth = esf.ClientCredentials(
    domain="https://acme.my.salesforce.com",
    client_id=CLIENT_ID,
    client_secret=CLIENT_SECRET,
)

# Logs in on the first call. Refreshes the token for you.
with esf.Salesforce(auth) as sf:
    # Values are quoted for you: no SOQL injection.
    lead = sf.query_one(
        "SELECT Id, Name FROM Lead WHERE Email = {}", email
    )

    try:
        sf.sobject("Lead").update(lead["Id"], {"Status": "Working"})
    except esf.ValidationRuleFailed as exc:
        print(exc.message, exc.fields)  # one class per Salesforce error
{% endblock %}