Skip to main content

A Python toolset for performing Salesforce API calls

Project description

SalesPyForce

A Python toolset for performing Salesforce API calls

Latest Stable Release PyPI
Latest Beta/RC Release PyPI
Build Status GitHub Workflow Status
Supported Versions PyPI - Python Version
Code Coverage
Documentation Documentation Status
Security Audits Bandit
License License (GitHub)
Issues GitHub open issues
GitHub closed issues
Pull Requests GitHub pull open requests
GitHub closed pull requests

Overview

salespyforce is a Python toolkit focused on interacting with Salesforce APIs, with a primary Salesforce class that centralizes authentication, version selection, and access to helper feature sets (Chatter, Knowledge).

Installation

The package can be installed via pip using the syntax below.

pip install salespyforce --upgrade

Change Log

The change log can be found in the documentation.

Usage

This section provides basic usage instructions for the package.

Importing the package

Rather than importing the base package, it is recommended that you import the primary Salesforce class using the syntax below.

from salespyforce import Salesforce

Initializing a Salesforce object instance

The primary Salesforce object serves many purposes, the most important being to establish a connection to the Salesforce environment with which you intend to interact. As such, when initializing an instance of the Salesforce object, you will need to pass it the following information:

  • The username and password of the API user
  • The Organization ID of the Salesforce environment
  • The Base URL and Endpoint URL
  • The client ID, client secret, and security token

The Salesforce object can be initiated in two different ways:

  • Passing the information directly into the object
  • Leveraging a "helper" configuration file

Passing the information directly into the object

The environment and connection information can be passed directly into the Salesforce object when initializing it, as demonstrated in the example below.

sfdc = Salesforce(
    username='admin.user@example.com',
    password='example123',
    org_id='4DJ000000CeMFYA0',
    base_url='https://example-dev-ed.lightning.force.com/',
    endpoint_url='https://example-dev-ed.my.salesforce.com/services/oauth2/token',
    client_id='3MVG9gTv.DiE8cKRIpEtSN_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX_TAoy1Zk_AKGukbqa4KbhM6nVYVUu6md',
    client_secret='7536F4A7865559XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX53797BEA88174713CC3C',
    security_token='2muXaXXXXXXXXXXXXXXXoVKxz'
)

Leveraging a "helper" configuration file

As an alternative to passing the connection information to the Salesforce class in the way demonstrated above, a "helper" configuration file in yaml or json format can be leveraged instead and passed to the Salesforce class when initializing the object.

This is an example of how the configuration file would be written in YAML format:

# Helper configuration file for the SalesPyForce package

# Define how to obtain the connection information
connection:
    # Define the credentials
    username: admin.user@example.com
    password: example123

    # Define the org information
    org_id: 4DJ000000CeMFYA0
    base_url: https://example-dev-ed.lightning.force.com/
    endpoint_url: https://example-dev-ed.my.salesforce.com/services/oauth2/token

    # Define the API connection info
    client_key: 3MVG9gTv.DiE8cKRIpEtSN_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX_TAoy1Zk_AKGukbqa4KbhM6nVYVUu6md
    client_secret: 7536F4A7865559XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX53797BEA88174713CC3C
    security_token: 2muXaXXXXXXXXXXXXXXXoVKxz

# Define if SSL certificates should be verified when making API calls
ssl_verify: yes

The file can then be referenced using the helper argument when initializing the object instance, as shown below.

HELPER_FILE = '/path/to/helper.yml'
sfdc = Salesforce(helper=HELPER_FILE)

Documentation

The documentation is located here: https://salespyforce.readthedocs.io/en/latest/

License

MIT License

Reporting Issues

Issues can be reported within the GitHub repository.

Donations

If you would like to donate to this project then you can do so using this PayPal link.

Disclaimer

This package is considered unofficial and is in no way endorsed or supported by Salesforce Inc.

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

salespyforce-1.4.0.tar.gz (44.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

salespyforce-1.4.0-py3-none-any.whl (54.5 kB view details)

Uploaded Python 3

File details

Details for the file salespyforce-1.4.0.tar.gz.

File metadata

  • Download URL: salespyforce-1.4.0.tar.gz
  • Upload date:
  • Size: 44.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for salespyforce-1.4.0.tar.gz
Algorithm Hash digest
SHA256 ba3a944c522414634854cc5848dfe359feb7313e8be0f027842f6a7137f4792e
MD5 e052d4c78d27195a0ae37226a946d88e
BLAKE2b-256 efd2c6a69122b0aa7bd9ca60369e2e9b0552615c0cc03ccfb031903df29a09a0

See more details on using hashes here.

File details

Details for the file salespyforce-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: salespyforce-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 54.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for salespyforce-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 10b64afdd27f562b0321fa3392a6b2cab688a532a6edf1c8e38f9fae825ce7e4
MD5 aecb69a129030ae9fa4aef8d2d3f206b
BLAKE2b-256 d4e3b293abcb1a434b36ff804eb1886455eab5e2aafda23c236e503c8cea6a7c

See more details on using hashes here.

Supported by

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