salespyforce 1.4.0.dev0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- salespyforce-1.4.0.dev0/LICENSE +21 -0
- salespyforce-1.4.0.dev0/PKG-INFO +253 -0
- salespyforce-1.4.0.dev0/README.md +203 -0
- salespyforce-1.4.0.dev0/pyproject.toml +62 -0
- salespyforce-1.4.0.dev0/src/salespyforce/__init__.py +53 -0
- salespyforce-1.4.0.dev0/src/salespyforce/api.py +129 -0
- salespyforce-1.4.0.dev0/src/salespyforce/chatter.py +167 -0
- salespyforce-1.4.0.dev0/src/salespyforce/core.py +872 -0
- salespyforce-1.4.0.dev0/src/salespyforce/errors/__init__.py +12 -0
- salespyforce-1.4.0.dev0/src/salespyforce/errors/exceptions.py +389 -0
- salespyforce-1.4.0.dev0/src/salespyforce/errors/handlers.py +15 -0
- salespyforce-1.4.0.dev0/src/salespyforce/knowledge.py +531 -0
- salespyforce-1.4.0.dev0/src/salespyforce/utils/__init__.py +10 -0
- salespyforce-1.4.0.dev0/src/salespyforce/utils/core_utils.py +152 -0
- salespyforce-1.4.0.dev0/src/salespyforce/utils/helper.py +140 -0
- salespyforce-1.4.0.dev0/src/salespyforce/utils/log_utils.py +264 -0
- salespyforce-1.4.0.dev0/src/salespyforce/utils/tests/__init__.py +8 -0
- salespyforce-1.4.0.dev0/src/salespyforce/utils/tests/resources.py +157 -0
- salespyforce-1.4.0.dev0/src/salespyforce/utils/tests/test_instantiate_object.py +49 -0
- salespyforce-1.4.0.dev0/src/salespyforce/utils/tests/test_sobjects.py +58 -0
- salespyforce-1.4.0.dev0/src/salespyforce/utils/tests/test_soql.py +23 -0
- salespyforce-1.4.0.dev0/src/salespyforce/utils/tests/test_sosl.py +29 -0
- salespyforce-1.4.0.dev0/src/salespyforce/utils/version.py +52 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Jeff Shurtliff
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: salespyforce
|
|
3
|
+
Version: 1.4.0.dev0
|
|
4
|
+
Summary: A Python toolset for performing Salesforce API calls
|
|
5
|
+
License: MIT License
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2023 Jeff Shurtliff
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
Keywords: salesforce,sfdc,api,rest,tooling,python
|
|
27
|
+
Author: Jeff Shurtliff
|
|
28
|
+
Author-email: jeffshurtliff@gmail.com
|
|
29
|
+
Requires-Python: >=3.9,<4.0
|
|
30
|
+
Classifier: Development Status :: 4 - Beta
|
|
31
|
+
Classifier: Intended Audience :: Developers
|
|
32
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
33
|
+
Classifier: Programming Language :: Python :: 3
|
|
34
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
40
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
41
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
42
|
+
Requires-Dist: PyYAML (>=6.0.3,<7)
|
|
43
|
+
Requires-Dist: requests (>=2.32.5)
|
|
44
|
+
Project-URL: Documentation, https://salespyforce.readthedocs.io/en/latest/
|
|
45
|
+
Project-URL: Homepage, https://github.com/jeffshurtliff/salespyforce
|
|
46
|
+
Project-URL: Issue Tracker, https://github.com/jeffshurtliff/salespyforce/issues
|
|
47
|
+
Project-URL: Repository, https://github.com/jeffshurtliff/salespyforce
|
|
48
|
+
Description-Content-Type: text/markdown
|
|
49
|
+
|
|
50
|
+
# salespyforce
|
|
51
|
+
A Python toolset for performing Salesforce API calls
|
|
52
|
+
|
|
53
|
+
<table>
|
|
54
|
+
<tr>
|
|
55
|
+
<td>Latest Stable Release</td>
|
|
56
|
+
<td>
|
|
57
|
+
<a href='https://pypi.org/project/salespyforce/'>
|
|
58
|
+
<img alt="PyPI" src="https://img.shields.io/pypi/v/salespyforce">
|
|
59
|
+
</a>
|
|
60
|
+
</td>
|
|
61
|
+
</tr>
|
|
62
|
+
<tr>
|
|
63
|
+
<td>Latest Beta/RC Release</td>
|
|
64
|
+
<td>
|
|
65
|
+
<a href='https://pypi.org/project/salespyforce/#history'>
|
|
66
|
+
<img alt="PyPI" src="https://img.shields.io/badge/pypi-1.3.0rc3-blue">
|
|
67
|
+
</a>
|
|
68
|
+
</td>
|
|
69
|
+
</tr>
|
|
70
|
+
<tr>
|
|
71
|
+
<td>Build Status</td>
|
|
72
|
+
<td>
|
|
73
|
+
<a href="https://github.com/jeffshurtliff/salespyforce/blob/master/.github/workflows/pythonpackage.yml">
|
|
74
|
+
<img alt="GitHub Workflow Status"
|
|
75
|
+
src="https://img.shields.io/github/actions/workflow/status/jeffshurtliff/salespyforce/pythonpackage.yml?branch=master">
|
|
76
|
+
</a>
|
|
77
|
+
</td>
|
|
78
|
+
</tr>
|
|
79
|
+
<tr>
|
|
80
|
+
<td>Supported Versions</td>
|
|
81
|
+
<td>
|
|
82
|
+
<a href='https://pypi.org/project/salespyforce/'>
|
|
83
|
+
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/salespyforce">
|
|
84
|
+
</a>
|
|
85
|
+
</td>
|
|
86
|
+
</tr>
|
|
87
|
+
<tr>
|
|
88
|
+
<td>Code Coverage</td>
|
|
89
|
+
<td>
|
|
90
|
+
<a href="https://codecov.io/gh/jeffshurtliff/salespyforce">
|
|
91
|
+
<img src="https://codecov.io/gh/jeffshurtliff/salespyforce/branch/master/graph/badge.svg" />
|
|
92
|
+
</a>
|
|
93
|
+
</td>
|
|
94
|
+
</tr>
|
|
95
|
+
<tr>
|
|
96
|
+
<td>Documentation</td>
|
|
97
|
+
<td>
|
|
98
|
+
<a href='https://salespyforce.readthedocs.io/en/latest/?badge=latest'>
|
|
99
|
+
<img src='https://readthedocs.org/projects/salespyforce/badge/?version=latest' alt='Documentation Status' />
|
|
100
|
+
</a>
|
|
101
|
+
</td>
|
|
102
|
+
</tr>
|
|
103
|
+
<tr>
|
|
104
|
+
<td>Security Audits</td>
|
|
105
|
+
<td>
|
|
106
|
+
<a href="https://github.com/marketplace/actions/python-security-check-using-bandit">
|
|
107
|
+
<img alt="Bandit" src="https://img.shields.io/badge/security-bandit-yellow.svg">
|
|
108
|
+
</a>
|
|
109
|
+
</td>
|
|
110
|
+
</tr>
|
|
111
|
+
<tr>
|
|
112
|
+
<td>License</td>
|
|
113
|
+
<td>
|
|
114
|
+
<a href="https://github.com/jeffshurtliff/salespyforce/blob/master/LICENSE">
|
|
115
|
+
<img alt="License (GitHub)" src="https://img.shields.io/github/license/jeffshurtliff/salespyforce">
|
|
116
|
+
</a>
|
|
117
|
+
</td>
|
|
118
|
+
</tr>
|
|
119
|
+
<tr>
|
|
120
|
+
<td style="vertical-align: top;">Issues</td>
|
|
121
|
+
<td>
|
|
122
|
+
<a href="https://github.com/jeffshurtliff/salespyforce/issues">
|
|
123
|
+
<img style="margin-bottom:5px;" alt="GitHub open issues" src="https://img.shields.io/github/issues-raw/jeffshurtliff/salespyforce"><br />
|
|
124
|
+
</a>
|
|
125
|
+
<a href="https://github.com/jeffshurtliff/salespyforce/issues">
|
|
126
|
+
<img alt="GitHub closed issues" src="https://img.shields.io/github/issues-closed-raw/jeffshurtliff/salespyforce">
|
|
127
|
+
</a>
|
|
128
|
+
</td>
|
|
129
|
+
</tr>
|
|
130
|
+
<tr>
|
|
131
|
+
<td style="vertical-align: top;">Pull Requests</td>
|
|
132
|
+
<td>
|
|
133
|
+
<a href="https://github.com/jeffshurtliff/salespyforce/pulls">
|
|
134
|
+
<img style="margin-bottom:5px;" alt="GitHub pull open requests" src="https://img.shields.io/github/issues-pr-raw/jeffshurtliff/salespyforce"><br />
|
|
135
|
+
</a>
|
|
136
|
+
<a href="https://github.com/jeffshurtliff/salespyforce/pulls">
|
|
137
|
+
<img alt="GitHub closed pull requests" src="https://img.shields.io/github/issues-pr-closed-raw/jeffshurtliff/salespyforce">
|
|
138
|
+
</a>
|
|
139
|
+
</td>
|
|
140
|
+
</tr>
|
|
141
|
+
</table>
|
|
142
|
+
|
|
143
|
+
## Installation
|
|
144
|
+
The package can be installed via pip using the syntax below.
|
|
145
|
+
|
|
146
|
+
```sh
|
|
147
|
+
pip install salespyforce --upgrade
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
You may also clone the repository and install from source using below.
|
|
151
|
+
|
|
152
|
+
```sh
|
|
153
|
+
git clone git://github.com/jeffshurtliff/salespyforce.git
|
|
154
|
+
cd salespyforce/
|
|
155
|
+
python setup.py install
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Change Log
|
|
159
|
+
The change log can be found in the [documentation](https://salespyforce.readthedocs.io/en/latest/changelog.html).
|
|
160
|
+
|
|
161
|
+
## Usage
|
|
162
|
+
This section provides basic usage instructions for the package.
|
|
163
|
+
|
|
164
|
+
### Importing the package
|
|
165
|
+
Rather than importing the base package, it is recommended that you import the primary `Salesforce` class using the
|
|
166
|
+
syntax below.
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
from salespyforce import Salesforce
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Initializing a Salesforce object instance
|
|
173
|
+
The primary `Salesforce` object serves many purposes, the most important being to establish a connection to the
|
|
174
|
+
Salesforce environment with which you intend to interact. As such, when initializing an instance of the `Salesforce`
|
|
175
|
+
object, you will need to pass it the following information:
|
|
176
|
+
* The username and password of the API user
|
|
177
|
+
* The Organization ID of the Salesforce environment
|
|
178
|
+
* The Base URL and Endpoint URL
|
|
179
|
+
* The client ID, client secret, and security token
|
|
180
|
+
|
|
181
|
+
The `Salesforce` object can be initiated in two different ways:
|
|
182
|
+
* Passing the information directly into the object
|
|
183
|
+
* Leveraging a "helper" configuration file
|
|
184
|
+
|
|
185
|
+
#### Passing the information directly into the object
|
|
186
|
+
The environment and connection information can be passed directly into the `Salesforce` object when initializing it,
|
|
187
|
+
as demonstrated in the example below.
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
sfdc = Salesforce(
|
|
191
|
+
username='admin.user@example.com',
|
|
192
|
+
password='example123',
|
|
193
|
+
org_id='4DJ000000CeMFYA0',
|
|
194
|
+
base_url='https://example-dev-ed.lightning.force.com/',
|
|
195
|
+
endpoint_url='https://example-dev-ed.my.salesforce.com/services/oauth2/token',
|
|
196
|
+
client_id='3MVG9gTv.DiE8cKRIpEtSN_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX_TAoy1Zk_AKGukbqa4KbhM6nVYVUu6md',
|
|
197
|
+
client_secret='7536F4A7865559XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX53797BEA88174713CC3C',
|
|
198
|
+
security_token='2muXaXXXXXXXXXXXXXXXoVKxz'
|
|
199
|
+
)
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
#### Leveraging a "helper" configuration file
|
|
203
|
+
As an alternative to passing the connection information to the `Salesforce` class in the way demonstrated above, a
|
|
204
|
+
"helper" configuration file in `yaml` or `json` format can be leveraged instead and passed to the `Salesforce` class
|
|
205
|
+
when initializing the object.
|
|
206
|
+
|
|
207
|
+
This is an example of how the configuration file would be written in YAML format:
|
|
208
|
+
|
|
209
|
+
```yaml
|
|
210
|
+
# Helper configuration file for the SalesPyForce package
|
|
211
|
+
|
|
212
|
+
# Define how to obtain the connection information
|
|
213
|
+
connection:
|
|
214
|
+
# Define the credentials
|
|
215
|
+
username: admin.user@example.com
|
|
216
|
+
password: example123
|
|
217
|
+
|
|
218
|
+
# Define the org information
|
|
219
|
+
org_id: 4DJ000000CeMFYA0
|
|
220
|
+
base_url: https://example-dev-ed.lightning.force.com/
|
|
221
|
+
endpoint_url: https://example-dev-ed.my.salesforce.com/services/oauth2/token
|
|
222
|
+
|
|
223
|
+
# Define the API connection info
|
|
224
|
+
client_key: 3MVG9gTv.DiE8cKRIpEtSN_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX_TAoy1Zk_AKGukbqa4KbhM6nVYVUu6md
|
|
225
|
+
client_secret: 7536F4A7865559XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX53797BEA88174713CC3C
|
|
226
|
+
security_token: 2muXaXXXXXXXXXXXXXXXoVKxz
|
|
227
|
+
|
|
228
|
+
# Define if SSL certificates should be verified when making API calls
|
|
229
|
+
ssl_verify: yes
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
The file can then be referenced using the `helper` argument when initializing the object instance, as shown below.
|
|
233
|
+
|
|
234
|
+
```python
|
|
235
|
+
HELPER_FILE = '/path/to/helper.yml'
|
|
236
|
+
sfdc = Salesforce(helper=HELPER_FILE)
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Documentation
|
|
240
|
+
The documentation is located here: [https://salespyforce.readthedocs.io/en/latest/](https://salespyforce.readthedocs.io/en/latest/)
|
|
241
|
+
|
|
242
|
+
## License
|
|
243
|
+
[MIT License](https://github.com/jeffshurtliff/salespyforce/blob/master/LICENSE)
|
|
244
|
+
|
|
245
|
+
## Reporting Issues
|
|
246
|
+
Issues can be reported within the [GitHub repository](https://github.com/jeffshurtliff/salespyforce/issues).
|
|
247
|
+
|
|
248
|
+
## Donations
|
|
249
|
+
If you would like to donate to this project then you can do so using [this PayPal link](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=XDZ8M6UV6EFK6&item_name=SalesPyForce+Python+API¤cy_code=USD).
|
|
250
|
+
|
|
251
|
+
## Disclaimer
|
|
252
|
+
This package is considered unofficial and is in no way endorsed or supported by [Salesforce Inc](https://www.salesforce.com).
|
|
253
|
+
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# salespyforce
|
|
2
|
+
A Python toolset for performing Salesforce API calls
|
|
3
|
+
|
|
4
|
+
<table>
|
|
5
|
+
<tr>
|
|
6
|
+
<td>Latest Stable Release</td>
|
|
7
|
+
<td>
|
|
8
|
+
<a href='https://pypi.org/project/salespyforce/'>
|
|
9
|
+
<img alt="PyPI" src="https://img.shields.io/pypi/v/salespyforce">
|
|
10
|
+
</a>
|
|
11
|
+
</td>
|
|
12
|
+
</tr>
|
|
13
|
+
<tr>
|
|
14
|
+
<td>Latest Beta/RC Release</td>
|
|
15
|
+
<td>
|
|
16
|
+
<a href='https://pypi.org/project/salespyforce/#history'>
|
|
17
|
+
<img alt="PyPI" src="https://img.shields.io/badge/pypi-1.3.0rc3-blue">
|
|
18
|
+
</a>
|
|
19
|
+
</td>
|
|
20
|
+
</tr>
|
|
21
|
+
<tr>
|
|
22
|
+
<td>Build Status</td>
|
|
23
|
+
<td>
|
|
24
|
+
<a href="https://github.com/jeffshurtliff/salespyforce/blob/master/.github/workflows/pythonpackage.yml">
|
|
25
|
+
<img alt="GitHub Workflow Status"
|
|
26
|
+
src="https://img.shields.io/github/actions/workflow/status/jeffshurtliff/salespyforce/pythonpackage.yml?branch=master">
|
|
27
|
+
</a>
|
|
28
|
+
</td>
|
|
29
|
+
</tr>
|
|
30
|
+
<tr>
|
|
31
|
+
<td>Supported Versions</td>
|
|
32
|
+
<td>
|
|
33
|
+
<a href='https://pypi.org/project/salespyforce/'>
|
|
34
|
+
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/salespyforce">
|
|
35
|
+
</a>
|
|
36
|
+
</td>
|
|
37
|
+
</tr>
|
|
38
|
+
<tr>
|
|
39
|
+
<td>Code Coverage</td>
|
|
40
|
+
<td>
|
|
41
|
+
<a href="https://codecov.io/gh/jeffshurtliff/salespyforce">
|
|
42
|
+
<img src="https://codecov.io/gh/jeffshurtliff/salespyforce/branch/master/graph/badge.svg" />
|
|
43
|
+
</a>
|
|
44
|
+
</td>
|
|
45
|
+
</tr>
|
|
46
|
+
<tr>
|
|
47
|
+
<td>Documentation</td>
|
|
48
|
+
<td>
|
|
49
|
+
<a href='https://salespyforce.readthedocs.io/en/latest/?badge=latest'>
|
|
50
|
+
<img src='https://readthedocs.org/projects/salespyforce/badge/?version=latest' alt='Documentation Status' />
|
|
51
|
+
</a>
|
|
52
|
+
</td>
|
|
53
|
+
</tr>
|
|
54
|
+
<tr>
|
|
55
|
+
<td>Security Audits</td>
|
|
56
|
+
<td>
|
|
57
|
+
<a href="https://github.com/marketplace/actions/python-security-check-using-bandit">
|
|
58
|
+
<img alt="Bandit" src="https://img.shields.io/badge/security-bandit-yellow.svg">
|
|
59
|
+
</a>
|
|
60
|
+
</td>
|
|
61
|
+
</tr>
|
|
62
|
+
<tr>
|
|
63
|
+
<td>License</td>
|
|
64
|
+
<td>
|
|
65
|
+
<a href="https://github.com/jeffshurtliff/salespyforce/blob/master/LICENSE">
|
|
66
|
+
<img alt="License (GitHub)" src="https://img.shields.io/github/license/jeffshurtliff/salespyforce">
|
|
67
|
+
</a>
|
|
68
|
+
</td>
|
|
69
|
+
</tr>
|
|
70
|
+
<tr>
|
|
71
|
+
<td style="vertical-align: top;">Issues</td>
|
|
72
|
+
<td>
|
|
73
|
+
<a href="https://github.com/jeffshurtliff/salespyforce/issues">
|
|
74
|
+
<img style="margin-bottom:5px;" alt="GitHub open issues" src="https://img.shields.io/github/issues-raw/jeffshurtliff/salespyforce"><br />
|
|
75
|
+
</a>
|
|
76
|
+
<a href="https://github.com/jeffshurtliff/salespyforce/issues">
|
|
77
|
+
<img alt="GitHub closed issues" src="https://img.shields.io/github/issues-closed-raw/jeffshurtliff/salespyforce">
|
|
78
|
+
</a>
|
|
79
|
+
</td>
|
|
80
|
+
</tr>
|
|
81
|
+
<tr>
|
|
82
|
+
<td style="vertical-align: top;">Pull Requests</td>
|
|
83
|
+
<td>
|
|
84
|
+
<a href="https://github.com/jeffshurtliff/salespyforce/pulls">
|
|
85
|
+
<img style="margin-bottom:5px;" alt="GitHub pull open requests" src="https://img.shields.io/github/issues-pr-raw/jeffshurtliff/salespyforce"><br />
|
|
86
|
+
</a>
|
|
87
|
+
<a href="https://github.com/jeffshurtliff/salespyforce/pulls">
|
|
88
|
+
<img alt="GitHub closed pull requests" src="https://img.shields.io/github/issues-pr-closed-raw/jeffshurtliff/salespyforce">
|
|
89
|
+
</a>
|
|
90
|
+
</td>
|
|
91
|
+
</tr>
|
|
92
|
+
</table>
|
|
93
|
+
|
|
94
|
+
## Installation
|
|
95
|
+
The package can be installed via pip using the syntax below.
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
pip install salespyforce --upgrade
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
You may also clone the repository and install from source using below.
|
|
102
|
+
|
|
103
|
+
```sh
|
|
104
|
+
git clone git://github.com/jeffshurtliff/salespyforce.git
|
|
105
|
+
cd salespyforce/
|
|
106
|
+
python setup.py install
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Change Log
|
|
110
|
+
The change log can be found in the [documentation](https://salespyforce.readthedocs.io/en/latest/changelog.html).
|
|
111
|
+
|
|
112
|
+
## Usage
|
|
113
|
+
This section provides basic usage instructions for the package.
|
|
114
|
+
|
|
115
|
+
### Importing the package
|
|
116
|
+
Rather than importing the base package, it is recommended that you import the primary `Salesforce` class using the
|
|
117
|
+
syntax below.
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
from salespyforce import Salesforce
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Initializing a Salesforce object instance
|
|
124
|
+
The primary `Salesforce` object serves many purposes, the most important being to establish a connection to the
|
|
125
|
+
Salesforce environment with which you intend to interact. As such, when initializing an instance of the `Salesforce`
|
|
126
|
+
object, you will need to pass it the following information:
|
|
127
|
+
* The username and password of the API user
|
|
128
|
+
* The Organization ID of the Salesforce environment
|
|
129
|
+
* The Base URL and Endpoint URL
|
|
130
|
+
* The client ID, client secret, and security token
|
|
131
|
+
|
|
132
|
+
The `Salesforce` object can be initiated in two different ways:
|
|
133
|
+
* Passing the information directly into the object
|
|
134
|
+
* Leveraging a "helper" configuration file
|
|
135
|
+
|
|
136
|
+
#### Passing the information directly into the object
|
|
137
|
+
The environment and connection information can be passed directly into the `Salesforce` object when initializing it,
|
|
138
|
+
as demonstrated in the example below.
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
sfdc = Salesforce(
|
|
142
|
+
username='admin.user@example.com',
|
|
143
|
+
password='example123',
|
|
144
|
+
org_id='4DJ000000CeMFYA0',
|
|
145
|
+
base_url='https://example-dev-ed.lightning.force.com/',
|
|
146
|
+
endpoint_url='https://example-dev-ed.my.salesforce.com/services/oauth2/token',
|
|
147
|
+
client_id='3MVG9gTv.DiE8cKRIpEtSN_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX_TAoy1Zk_AKGukbqa4KbhM6nVYVUu6md',
|
|
148
|
+
client_secret='7536F4A7865559XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX53797BEA88174713CC3C',
|
|
149
|
+
security_token='2muXaXXXXXXXXXXXXXXXoVKxz'
|
|
150
|
+
)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
#### Leveraging a "helper" configuration file
|
|
154
|
+
As an alternative to passing the connection information to the `Salesforce` class in the way demonstrated above, a
|
|
155
|
+
"helper" configuration file in `yaml` or `json` format can be leveraged instead and passed to the `Salesforce` class
|
|
156
|
+
when initializing the object.
|
|
157
|
+
|
|
158
|
+
This is an example of how the configuration file would be written in YAML format:
|
|
159
|
+
|
|
160
|
+
```yaml
|
|
161
|
+
# Helper configuration file for the SalesPyForce package
|
|
162
|
+
|
|
163
|
+
# Define how to obtain the connection information
|
|
164
|
+
connection:
|
|
165
|
+
# Define the credentials
|
|
166
|
+
username: admin.user@example.com
|
|
167
|
+
password: example123
|
|
168
|
+
|
|
169
|
+
# Define the org information
|
|
170
|
+
org_id: 4DJ000000CeMFYA0
|
|
171
|
+
base_url: https://example-dev-ed.lightning.force.com/
|
|
172
|
+
endpoint_url: https://example-dev-ed.my.salesforce.com/services/oauth2/token
|
|
173
|
+
|
|
174
|
+
# Define the API connection info
|
|
175
|
+
client_key: 3MVG9gTv.DiE8cKRIpEtSN_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX_TAoy1Zk_AKGukbqa4KbhM6nVYVUu6md
|
|
176
|
+
client_secret: 7536F4A7865559XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX53797BEA88174713CC3C
|
|
177
|
+
security_token: 2muXaXXXXXXXXXXXXXXXoVKxz
|
|
178
|
+
|
|
179
|
+
# Define if SSL certificates should be verified when making API calls
|
|
180
|
+
ssl_verify: yes
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
The file can then be referenced using the `helper` argument when initializing the object instance, as shown below.
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
HELPER_FILE = '/path/to/helper.yml'
|
|
187
|
+
sfdc = Salesforce(helper=HELPER_FILE)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Documentation
|
|
191
|
+
The documentation is located here: [https://salespyforce.readthedocs.io/en/latest/](https://salespyforce.readthedocs.io/en/latest/)
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
[MIT License](https://github.com/jeffshurtliff/salespyforce/blob/master/LICENSE)
|
|
195
|
+
|
|
196
|
+
## Reporting Issues
|
|
197
|
+
Issues can be reported within the [GitHub repository](https://github.com/jeffshurtliff/salespyforce/issues).
|
|
198
|
+
|
|
199
|
+
## Donations
|
|
200
|
+
If you would like to donate to this project then you can do so using [this PayPal link](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=XDZ8M6UV6EFK6&item_name=SalesPyForce+Python+API¤cy_code=USD).
|
|
201
|
+
|
|
202
|
+
## Disclaimer
|
|
203
|
+
This package is considered unofficial and is in no way endorsed or supported by [Salesforce Inc](https://www.salesforce.com).
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "salespyforce"
|
|
3
|
+
version = "1.4.0.dev0"
|
|
4
|
+
description = "A Python toolset for performing Salesforce API calls"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.9,<4.0"
|
|
7
|
+
license = { file = "LICENSE" }
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "Jeff Shurtliff", email = "jeffshurtliff@gmail.com" }
|
|
10
|
+
]
|
|
11
|
+
keywords = ["salesforce", "sfdc", "api", "rest", "tooling", "python"]
|
|
12
|
+
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
19
|
+
"Programming Language :: Python :: 3.9",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Topic :: Software Development :: Libraries",
|
|
25
|
+
"Topic :: Internet :: WWW/HTTP"
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
dependencies = [
|
|
29
|
+
"PyYAML>=6.0.3,<7",
|
|
30
|
+
"requests>=2.32.5",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://github.com/jeffshurtliff/salespyforce"
|
|
35
|
+
Repository = "https://github.com/jeffshurtliff/salespyforce"
|
|
36
|
+
Documentation = "https://salespyforce.readthedocs.io/en/latest/"
|
|
37
|
+
"Issue Tracker" = "https://github.com/jeffshurtliff/salespyforce/issues"
|
|
38
|
+
|
|
39
|
+
# --------------------------------------------------------------------
|
|
40
|
+
# Poetry-specific config
|
|
41
|
+
# --------------------------------------------------------------------
|
|
42
|
+
[tool.poetry]
|
|
43
|
+
packages = [
|
|
44
|
+
{ include = "salespyforce", from = "src" }
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
include = ["LICENSE", "README.md"]
|
|
48
|
+
|
|
49
|
+
[tool.poetry.group.dev.dependencies]
|
|
50
|
+
pytest = "^7.2"
|
|
51
|
+
bandit = { version = "^1.7.8", extras = ["sarif"] }
|
|
52
|
+
# Sphinx = "^7.0"
|
|
53
|
+
# sphinxcontrib-applehelp = ">=1.0.2"
|
|
54
|
+
# sphinxcontrib-devhelp = ">=1.0.2"
|
|
55
|
+
# sphinxcontrib-htmlhelp = ">=2.0.0"
|
|
56
|
+
# sphinxcontrib-jsmath = ">=1.0.1"
|
|
57
|
+
# sphinxcontrib-qthelp = ">=1.0.3"
|
|
58
|
+
# sphinxcontrib-serializinghtml = ">=1.1.4"
|
|
59
|
+
|
|
60
|
+
[build-system]
|
|
61
|
+
requires = ["poetry-core>=1.2.0"]
|
|
62
|
+
build-backend = "poetry.core.masonry.api"
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
:Module: salespyforce
|
|
4
|
+
:Synopsis: This is the ``__init__`` module for the salespyforce package
|
|
5
|
+
:Created By: Jeff Shurtliff
|
|
6
|
+
:Last Modified: Jeff Shurtliff
|
|
7
|
+
:Modified Date: 08 May 2023
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from . import core
|
|
11
|
+
from .core import Salesforce
|
|
12
|
+
from .utils import version
|
|
13
|
+
|
|
14
|
+
__all__ = ['core', 'Salesforce']
|
|
15
|
+
|
|
16
|
+
# Define the package version by pulling from the highspot.utils.version module
|
|
17
|
+
__version__ = version.get_full_version()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# Allow the core.define_connection_info() function to be executed directly
|
|
21
|
+
def define_connection_info():
|
|
22
|
+
"""This function prompts the user for the connection information.
|
|
23
|
+
|
|
24
|
+
:returns: The connection info in a dictionary
|
|
25
|
+
"""
|
|
26
|
+
return core.define_connection_info()
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# Allow the core.compile_connection_info() function to be executed directly
|
|
30
|
+
def compile_connection_info(base_url, org_id, username, password, endpoint_url,
|
|
31
|
+
client_id, client_secret, security_token):
|
|
32
|
+
"""This function compiles the connection info into a dictionary that can be consumed by the core object.
|
|
33
|
+
|
|
34
|
+
:param base_url: The base URL of the Salesforce instance
|
|
35
|
+
:type base_url: str
|
|
36
|
+
:param org_id: The Org ID of the Salesforce instance
|
|
37
|
+
:type org_id: str
|
|
38
|
+
:param username: The username of the API user
|
|
39
|
+
:type username: str
|
|
40
|
+
:param password: The password of the API user
|
|
41
|
+
:type password: str
|
|
42
|
+
:param endpoint_url: The endpoint URL for the Salesforce instance
|
|
43
|
+
:type endpoint_url: str
|
|
44
|
+
:param client_id: The Client ID for the Salesforce instance
|
|
45
|
+
:type client_id: str
|
|
46
|
+
:param client_secret: The Client Secret for the Salesforce instance
|
|
47
|
+
:type client_secret: str
|
|
48
|
+
:param security_token: The Security Token for the Salesforce instance
|
|
49
|
+
:type security_token: str
|
|
50
|
+
:returns: The connection info in a dictionary
|
|
51
|
+
"""
|
|
52
|
+
return core.compile_connection_info(base_url, org_id, username, password, endpoint_url,
|
|
53
|
+
client_id, client_secret, security_token)
|