Skip to main content

simple-salesforce extends library

Project description

simple-salesforce-extends

PyPI version badge

About

This package extends the simple-salesforce package to support the use of AWS Secrets Manager to store the Salesforce credentials.
API request with the stored token if hold the token.
If the token is expired, re-authenticate and store the new token.

Required

  • Python 3.11+
  • simple-salesforce
  • boto3

Install

$ pip install simple-salesforce-extends

Prepare

Create a secret in AWS Secrets Manager with the following format:

{
    "Domain": "yourdomain.my",
    "ConsumerKey": "3MV.....",
    "ConsumerSecret": "1234ABCD...."
}

Usage

import boto3
from simple_salesforce_extends import SalesforceClientCredential

sfdc_credential_secrets_arn = "arn:aws:secretsmanager:us-east-1:123456789012:secret:your-secret-arn"
secrets_client = boto3.client("secretsmanager", region_name="us-east-1")

sf = SalesforceClientCredential(
    secrets_client=secrets_client,
    credentials_secrets_manager_arn=sfdc_credential_secrets_arn,
)

soql = "SELECT Id, Name FROM Account LIMIT 1"
result = sf.query(soql)
print(result["records"][0])

Test

$ python -m unittest discover -s src/

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

simple-salesforce-extends-0.2.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file simple-salesforce-extends-0.2.0.tar.gz.

File metadata

File hashes

Hashes for simple-salesforce-extends-0.2.0.tar.gz
Algorithm Hash digest
SHA256 083f0b2f48e50baf296b02f4f96a6057de3aa7bc3e711eb53619c63a3df994ef
MD5 eeb76e762305c7e0686ee0b553ed66fe
BLAKE2b-256 979bfa0633eb067a4481d0b020b3706fc38a5fd1ea6a62524fa94d3389fadffc

See more details on using hashes here.

File details

Details for the file simple_salesforce_extends-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_salesforce_extends-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 588fdec2a1b3592de5f3dcc2d2489206e277eac863063374a18e29d8148d7b5b
MD5 191a619d997984e5244e8e84bb0bd96d
BLAKE2b-256 9f86c66c4f3a3571eb9fa43d626282841704939e71992e0fe44edf2d539269db

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