Package: salespyforce
salespyforceA Python toolset for performing Salesforce API callsLatest Stable ReleaseLatest Beta/RC ReleaseBuild StatusSupported VersionsCode CoverageDocumentationSecurity AuditsLicenseIssuesPull RequestsInstallationThe package can be installed via pip using the syntax below.pipinstallsalespyforce--upgradeYou may also clone the repository and install from source using below.gitclonegit://github.com/jeffshurtliff/salespyforce.gitcdsalespyforce/
pythonsetup.pyinstallChange LogThe change log can be found in thedocumentation.UsageThis section provides basic usage instructions for the package.Importing the packageRather than importing the base package, it is recommended that you import the primarySalesforceclass using the
syntax below.fromsalespyforceimportSalesforceInitializing a Salesforce object instanceThe primarySalesforceobject 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 theSalesforceobject, you will need to pass it the following information:The username and password of the API userThe Organization ID of the Salesforce environmentThe Base URL and Endpoint URLThe client ID, client secret, and security tokenTheSalesforceobject can be initiated in two different ways:Passing the information directly into the objectLeveraging a "helper" configuration filePassing the information directly into the objectThe environment and connection information can be passed directly into theSalesforceobject 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 fileAs an alternative to passing the connection information to theSalesforceclass in the way demonstrated above, a
"helper" configuration file inyamlorjsonformat can be leveraged instead and passed to theSalesforceclass
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 informationconnection:# Define the credentialsusername:admin.user@example.compassword:example123# Define the org informationorg_id:4DJ000000CeMFYA0base_url:https://example-dev-ed.lightning.force.com/endpoint_url:https://example-dev-ed.my.salesforce.com/services/oauth2/token# Define the API connection infoclient_key:3MVG9gTv.DiE8cKRIpEtSN_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX_TAoy1Zk_AKGukbqa4KbhM6nVYVUu6mdclient_secret:7536F4A7865559XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX53797BEA88174713CC3Csecurity_token:2muXaXXXXXXXXXXXXXXXoVKxz# Define if SSL certificates should be verified when making API callsssl_verify:yesThe file can then be referenced using thehelperargument when initializing the object instance, as shown below.HELPER_FILE='/path/to/helper.yml'sfdc=Salesforce(helper=HELPER_FILE)DocumentationThe documentation is located here:https://salespyforce.readthedocs.io/en/latest/LicenseMIT LicenseReporting IssuesIssues can be reported within theGitHub repository.DonationsIf you would like to donate to this project then you can do so usingthis PayPal link.DisclaimerThis package is considered unofficial and is in no way endorsed or supported bySalesforce Inc.