Skip to main content

even-simpler-salesforce: async-first Salesforce on httpx. Skip the boilerplate.

Documentation · PyPI · Getting started · Changelog

PyPI version Python 3.10 to 3.14 CI Docs License: Apache-2.0

A typed Salesforce client for Python built on httpx. It is async-first, and a sync client with the same methods is generated from the async code. OAuth refresh applies to every call, failures raise specific exception classes, each call produces one structured log event with its API usage, and SOQL values are quoted for you. You pick a login flow (client credentials, JWT bearer, web server with PKCE, or an existing token). The client then handles tokens, retries, pagination, chunking and error mapping.

Project status: beta (0.5). Breaking changes are still possible in 0.x minor releases. They are always listed under Changed / Removed in the changelog with migration notes, and deprecated APIs keep working for at least one minor release.

Tested on
Editions Developer Edition, and a sandbox of an Enterprise org (read-only checks)
API version 68.0 (library default)
Auth flows exercised Web server flow with PKCE and refresh-token rotation (External Client App)

Not tested yet: orgs with a namespace, Experience Cloud sites, person accounts, multi-currency and Shield. If you run it against another setup, please share your results by opening an issue or pull request.

Install

pip install even-simpler-salesforce

The only required dependency is httpx. Extras add optional features:

Extra Adds Needed for
jwt PyJWT, cryptography esf.JwtBearer
pydantic Pydantic 2 model= with Pydantic models
speed orjson faster JSON encoding and decoding
http2 httpx[http2] http2=True
otel opentelemetry-api esf.observability.OpenTelemetry
structlog structlog esf.observability.Structlog
testing pytest, respx the esf.testing helpers and pytest plugin
pubsub grpcio, protobuf, fastavro sf.pubsub subscriptions and Change Data Capture
migrate libcst the esf migrate codemod from simple-salesforce
fastapi, flask the framework the even_simpler_salesforce.contrib.fastapi and .contrib.flask integrations
all everything above
pip install "even-simpler-salesforce[jwt,speed]"

Quick start

import asyncio
import os

import even_simpler_salesforce as esf

auth = esf.ClientCredentials(
    domain=os.environ["SF_DOMAIN"],  # https://<your-domain>.my.salesforce.com
    client_id=os.environ["SF_CLIENT_ID"],
    client_secret=os.environ["SF_CLIENT_SECRET"],
)


async def main() -> None:
    async with esf.AsyncSalesforce(auth) as sf:
        lead_id = await sf.sobject("Lead").create({"LastName": "Lovelace", "Company": "Engines"})
        page = await sf.query("SELECT Id, Name FROM Lead WHERE Id = {}", lead_id)
        print(page.records[0]["Name"], sf.usage.snapshot().api_used)


asyncio.run(main())

The sync client has the same methods, without await:

with esf.Salesforce(auth) as sf:
    lead_id = sf.sobject("Lead").create({"LastName": "Hopper", "Company": "Navy"})
    for lead in sf.query_iter("SELECT Id, Name FROM Lead WHERE Status = {}", "Open"):
        print(lead["Name"])

What's included

  • Clients: AsyncSalesforce and the generated Salesforce. with_auth() and tagged() return child clients that share the connection pool, caches and usage counters.
  • Login flows: ClientCredentials, JwtBearer, WebServerFlow (PKCE, code exchange, revoke, userinfo, introspection) and StaticToken. A refresh runs once even when many concurrent calls need it, and a rotated refresh token is saved before the new access token is used. Durable token stores use compare-and-swap, and a reusable contract test suite checks your own store.
  • Records: get, get by external id, create, update, upsert, delete, describe (cached and revalidated), updated/deleted windows, and conditional requests.
  • Query and search: pass values after the SOQL (sf.query("... WHERE Email = {}", email)) and they're quoted for you. query_one / query_first, pages with opaque cursors you can sign, query_iter (optionally following child subqueries), count, explain (query plans), esf.flatten for CSV/DataFrame export, SOSL search and parameterized_search.
  • sObject Collections: create, update, upsert, delete and retrieve, chunked (200 rows per write, 2,000 ids per read) and run concurrently. Results keep the input order, and a failure in one chunk raises PartialFailure with every row's result.
  • Request options: esf.DuplicateRules(...) and assignment rules on writes, update_mru= for recently viewed lists, default_namespace= for managed packages, and Salesforce Warning headers raised as esf.SalesforceWarning.
  • Raw requests: sf.request() sends any REST call through the same auth, retry, error and logging pipeline.
  • Errors: one exception hierarchy for REST, OAuth and Collections errors, with opt-in custom error classes matched on [TAG] prefixes in validation-rule messages.
  • Usage and budgets: API usage read from the Sforce-Limit-Info header of every response, counters by operation, sObject and caller, threshold events and a guard for low-priority calls.
  • Logging: one sf.request event per call with secrets redacted, observers for stdlib logging, structlog and OpenTelemetry, a capture() summary per unit of work, and readable ESF_DEBUG=1 output.
  • Testing: FakeSalesforce / AsyncFakeSalesforce, a recorder and replayer for redacted traffic, and a pytest plugin.
  • CLI: esf whoami, esf limits, esf query, esf describe, esf request, esf generate models, esf generate actions, and esf migrate (rewrites simple-salesforce code, [migrate] extra).
  • Coding agents: agent skills that ship with the library (esf skills install, for Claude Code, Codex and other Agent Skills clients) and an llms.txt index of the docs. See Coding agents.
  • More API areas: Files (streamed uploads and downloads), invocable actions and Apex REST, lead convert and merge, platform events, Bulk API 2.0, Tooling (including anonymous Apex), GraphQL, Composite, UI API, reports and dashboards, the Metadata API, and Pub/Sub subscriptions with Change Data Capture decoding ([pubsub] extra).
  • Integrations: FastAPI and Flask ([fastapi], [flask] extras).

For anything else, sf.request() can call any REST resource. See the documentation for each area.

Documentation

https://uttsavv.github.io/even-simpler-salesforce/ covers getting started, Salesforce setup (External Client Apps), each login flow, the guides, errors, logging, testing and the API reference.

Contributing

See CONTRIBUTING.md and AGENTS.md. Commits need a DCO sign-off.

Licence

Apache License 2.0; see LICENSE and NOTICE.

Not affiliated with or endorsed by Salesforce, Inc. "Salesforce" is a trademark of Salesforce, Inc.

Metadata

Release files for even-simpler-salesforce 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for even-simpler-salesforce 0.6.0
File Size Uploaded Provenance Actions
even_simpler_salesforce-0.6.0.tar.gz 1.5 MB With provenance Details for even_simpler_salesforce-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for even-simpler-salesforce 0.6.0
File Interpreter ABI Platform Actions
even_simpler_salesforce-0.6.0-py3-none-any.whl Python 3 none any Details for even_simpler_salesforce-0.6.0-py3-none-any.whl

Total release size: 2.0 MB

Release files / even_simpler_salesforce-0.6.0.tar.gz

Download URL even_simpler_salesforce-0.6.0.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
327a955737c1002e8704cfb2b8e350991215e264f467602f11d43e7a107bf75c
BLAKE2b-256 checksum
How to use checksums
e79cc3174d5a5f74d7b1f9d2af38e205a15401f025f350c184f334d53e928512
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / even_simpler_salesforce-0.6.0-py3-none-any.whl

Download URL even_simpler_salesforce-0.6.0-py3-none-any.whl
Size 521.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d165fee09aeb9f76fac3dfed48ef074652a75acb1bf2ff564b14fdb4807ebf9f
BLAKE2b-256 checksum
How to use checksums
385b79fdac72a57e094c39fce40bf12b92c5bf449ccc50d09276162d21ba8953
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for even-simpler-salesforce 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for even_simpler_salesforce-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page