Simple-Salesforce is a basic Salesforce.com REST API client built for Python 3.9 and newer versions. It provides a low-level interface to the Salesforce REST Resource and APEX API, returning JSON responses as Python dictionaries. The library facilitates common operations like authentication, CRUD operations on Salesforce objects, SOQL/SOSL queries, and interaction with Bulk and Metadata APIs. It's actively maintained with regular bug fixes and feature enhancements.
pip install simple-salesforceNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to authenticate with Salesforce using username, password, and security token, then perform a simple SOQL query, create an account, and delete it. It emphasizes using environment variables for sensitive credentials.
Explicitly specify the desired API version in the `Salesforce` constructor using `sf_version='X.Y'` (e.g., `sf_version='41.0'`). Ensure your project runs on Python 3.9+ for compatibility.
Obtain your Salesforce security token (often by resetting your password in Salesforce settings) and provide it either concatenated with your password or as the `security_token` parameter to the `Salesforce` constructor.
Carefully review your data payload against the Salesforce object's schema, ensuring all fields exist, have correct data types, and required fields are present. Validate external IDs for upsert operations.
When initializing `Salesforce`, include `domain='test'` for sandbox environments (e.g., `sf = Salesforce(username=..., password=..., security_token=..., domain='test')`).
Ensure the library is installed using `pip install simple-salesforce` and imported as `from simple_salesforce import Salesforce`.
Verify all credentials are correct, ensure the security token is appended directly to the password if required, and check for any IP restrictions or login hour policies on the Salesforce side.
Double-check the API name of the object/field/record ID for typos, and ensure the authenticated user has appropriate read/write permissions for that resource in Salesforce.
Re-establish the Salesforce connection by re-instantiating the `Salesforce` object with your credentials to generate a fresh, valid session ID.
Correct the method or object name to match `simple-salesforce`'s conventions or Salesforce's API names (e.g., `sf.query_all()` for queries or `sf.Contact.get()` for object methods).
No traffic data recorded yet.