Skip to main content

Async fork of simple-salesforce

Project description

Async Simple Salesforce

This is an async fork of the library simple-salesforce. It is considered alpha software.

This fork is available on PyPI and can be installed like this:

$ pip install "async-simple-salesforce==1.12.6a3"

Versioning

Versioning for this library tracks the upstream version; i.e., when a new version of upstream has been published, it will be integrated into this codebase and released under the same version identifier, with one notable difference: we add alpha or beta identifiers to make it more obvious that this fork has not been around as long as upstream and that it has also not seen the same wide-scale usage that upstream has.

For example, when changes from upstream version 1.12.4 have been integrated into this library, a new version of this library will be published as 1.12.4a1. Further changes under the same version will increment the alpha version identifier.

How to Use

This library attempts to offer the same API as simple-salesforce inside an aio subpackage.

For instance, here's how to create and use an async Salesforce client:

import asyncio
import datetime

from simple_salesforce.aio import build_async_salesforce_client, AsyncSalesforce


async def create_client(username, consumer_key, private_key) -> AsyncSalesforce:
    # build_async_salesforce_client accepts all args of simple-salesforce Login
    return await build_async_salesforce_client(
            username=username,
            consumer_key=consumer_key,
            privatekey_file=private_key,
            request_timeout_seconds=60 * 2,
        )

async def update_contact(sf_client):
    end = datetime.datetime.now(pytz.UTC) # we need to use UTC as salesforce API requires this
    await sf_client.Contact.updated(end - datetime.timedelta(days=10), end)


async def run_query(sf_client, opportunity_name: str):
    query = (
        f"SELECT Id,StageName from Opportunity where "
        f"Name='{opportunity_name}'"
    )
    return await sf_client.query_all(search)

You can typically call any method available on the synchronous Salesforce object as an async method with an await added.

See upstream docs continued here.

How to Contribute

This project uses uv to manage dependencies. In addition, a justfile has been provided to aid contributors. If you have uv and just in your environment, you can get started with just bootstrap. You can run the test suite with just test and code quality checks with just test. For more common recipes, run just:

 just
just --list
Available recipes:
    bootstrap                         # Create a virtual environment and install dependencies
    build *args                       # Build the project as a package
    check                             # Run code quality checks
    check-types                       # Run mypy checks
    ci-test coverage_dir='./coverage' # Run all tests locally
    format                            # Run the formatter (`ruff`)
    lock                              # Update the lock file
    release                           # Release this project to PyPI
    sync *args                        # Make sure all dependencies are up to date in env
    test *args                        # Run all tests locally

The upstream README is located here

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

async_simple_salesforce-1.12.6a4.tar.gz (190.9 kB view details)

Uploaded Source

Built Distribution

async_simple_salesforce-1.12.6a4-py3-none-any.whl (198.9 kB view details)

Uploaded Python 3

File details

Details for the file async_simple_salesforce-1.12.6a4.tar.gz.

File metadata

File hashes

Hashes for async_simple_salesforce-1.12.6a4.tar.gz
Algorithm Hash digest
SHA256 39fd88cd3a94ccae11d2b6432bf04ce5b65a678d227629dda1419ec172d83dd9
MD5 cf143824b0994fce4ad13e7fd0281428
BLAKE2b-256 3747a9fa8d0f1289113a2d4a4aebc53fb6ba2c91928999047aecbb319f34d114

See more details on using hashes here.

File details

Details for the file async_simple_salesforce-1.12.6a4-py3-none-any.whl.

File metadata

File hashes

Hashes for async_simple_salesforce-1.12.6a4-py3-none-any.whl
Algorithm Hash digest
SHA256 4fb57052f725a683eba33d93bce4e5c09327d85ef5d2fc11d426c06314cff935
MD5 29c074696f9b5c1637871d63f75cf030
BLAKE2b-256 04b4c4e25f339fabd64997ddc00d171022846be28b90ef656ef4344cfc1526c8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page