simple-salesforce extends library
Project description
simple-salesforce-extends
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simple-salesforce-extends-0.2.0.tar.gz.
File metadata
- Download URL: simple-salesforce-extends-0.2.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
083f0b2f48e50baf296b02f4f96a6057de3aa7bc3e711eb53619c63a3df994ef
|
|
| MD5 |
eeb76e762305c7e0686ee0b553ed66fe
|
|
| BLAKE2b-256 |
979bfa0633eb067a4481d0b020b3706fc38a5fd1ea6a62524fa94d3389fadffc
|
File details
Details for the file simple_salesforce_extends-0.2.0-py3-none-any.whl.
File metadata
- Download URL: simple_salesforce_extends-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
588fdec2a1b3592de5f3dcc2d2489206e277eac863063374a18e29d8148d7b5b
|
|
| MD5 |
191a619d997984e5244e8e84bb0bd96d
|
|
| BLAKE2b-256 |
9f86c66c4f3a3571eb9fa43d626282841704939e71992e0fe44edf2d539269db
|