sfq 0.0.22__py3-none-any.whl → 0.0.23__py3-none-any.whl
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.
sfq/__init__.py
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
"""
|
2
|
+
.. include:: ../../README.md
|
3
|
+
"""
|
4
|
+
|
1
5
|
import base64
|
2
6
|
import http.client
|
3
7
|
import json
|
@@ -10,6 +14,8 @@ from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
10
14
|
from typing import Any, Dict, Iterable, Literal, Optional, List, Tuple
|
11
15
|
from urllib.parse import quote, urlparse
|
12
16
|
|
17
|
+
__all__ = ["SFAuth"] # https://pdoc.dev/docs/pdoc.html#control-what-is-documented
|
18
|
+
|
13
19
|
TRACE = 5
|
14
20
|
logging.addLevelName(TRACE, "TRACE")
|
15
21
|
|
@@ -84,7 +90,7 @@ class SFAuth:
|
|
84
90
|
access_token: Optional[str] = None,
|
85
91
|
token_expiration_time: Optional[float] = None,
|
86
92
|
token_lifetime: int = 15 * 60,
|
87
|
-
user_agent: str = "sfq/0.0.
|
93
|
+
user_agent: str = "sfq/0.0.23",
|
88
94
|
sforce_client: str = "_auto",
|
89
95
|
proxy: str = "_auto",
|
90
96
|
) -> None:
|
@@ -94,27 +100,145 @@ class SFAuth:
|
|
94
100
|
:param instance_url: The Salesforce instance URL.
|
95
101
|
:param client_id: The client ID for OAuth.
|
96
102
|
:param refresh_token: The refresh token for OAuth.
|
97
|
-
:param client_secret: The client secret for OAuth
|
98
|
-
:param api_version: The Salesforce API version
|
99
|
-
:param token_endpoint: The token endpoint
|
100
|
-
:param access_token: The access token for the current session
|
101
|
-
:param token_expiration_time: The expiration time of the access token
|
102
|
-
:param token_lifetime: The lifetime of the access token in seconds
|
103
|
-
:param user_agent: Custom User-Agent string
|
104
|
-
:param sforce_client: Custom Application Identifier
|
105
|
-
:param proxy: The proxy configuration, "_auto" to use environment
|
103
|
+
:param client_secret: The client secret for OAuth.
|
104
|
+
:param api_version: The Salesforce API version.
|
105
|
+
:param token_endpoint: The token endpoint.
|
106
|
+
:param access_token: The access token for the current session.
|
107
|
+
:param token_expiration_time: The expiration time of the access token.
|
108
|
+
:param token_lifetime: The lifetime of the access token in seconds.
|
109
|
+
:param user_agent: Custom User-Agent string.
|
110
|
+
:param sforce_client: Custom Application Identifier.
|
111
|
+
:param proxy: The proxy configuration, "_auto" to use environment.
|
106
112
|
"""
|
107
113
|
self.instance_url = self._format_instance_url(instance_url)
|
114
|
+
"""
|
115
|
+
### `instance_url`
|
116
|
+
**The fully qualified Salesforce instance URL.**
|
117
|
+
|
118
|
+
- Should end with `.my.salesforce.com`
|
119
|
+
- No trailing slash
|
120
|
+
|
121
|
+
**Examples:**
|
122
|
+
- `https://sfq-dev-ed.trailblazer.my.salesforce.com`
|
123
|
+
- `https://sfq.my.salesforce.com`
|
124
|
+
- `https://sfq--dev.sandbox.my.salesforce.com`
|
125
|
+
"""
|
126
|
+
|
108
127
|
self.client_id = client_id
|
128
|
+
"""
|
129
|
+
### `client_id`
|
130
|
+
**The OAuth client ID.**
|
131
|
+
|
132
|
+
- Uniquely identifies your **Connected App** in Salesforce
|
133
|
+
- If using **Salesforce CLI**, this is `"PlatformCLI"`
|
134
|
+
- For other apps, find this value in the **Connected App details**
|
135
|
+
"""
|
136
|
+
|
109
137
|
self.client_secret = client_secret
|
138
|
+
"""
|
139
|
+
### `client_secret`
|
140
|
+
**The OAuth client secret.**
|
141
|
+
|
142
|
+
- Secret key associated with your Connected App
|
143
|
+
- For **Salesforce CLI**, this is typically an empty string `""`
|
144
|
+
- For custom apps, locate it in the **Connected App settings**
|
145
|
+
"""
|
146
|
+
|
110
147
|
self.refresh_token = refresh_token
|
148
|
+
"""
|
149
|
+
### `refresh_token`
|
150
|
+
**The OAuth refresh token.**
|
151
|
+
|
152
|
+
- Used to fetch new access tokens when the current one expires
|
153
|
+
- For CLI, obtain via:
|
154
|
+
|
155
|
+
```bash
|
156
|
+
sf org display --json
|
157
|
+
````
|
158
|
+
|
159
|
+
* For other apps, this value is returned during the **OAuth authorization flow**
|
160
|
+
* 📖 [Salesforce OAuth Flows Documentation](https://help.salesforce.com/s/articleView?id=xcloud.remoteaccess_oauth_flows.htm&type=5)
|
161
|
+
"""
|
162
|
+
|
111
163
|
self.api_version = api_version
|
164
|
+
"""
|
165
|
+
|
166
|
+
### `api_version`
|
167
|
+
|
168
|
+
**The Salesforce API version to use.**
|
169
|
+
|
170
|
+
* Must include the `"v"` prefix (e.g., `"v64.0"`)
|
171
|
+
* Periodically updated to align with new Salesforce releases
|
172
|
+
"""
|
173
|
+
|
112
174
|
self.token_endpoint = token_endpoint
|
175
|
+
"""
|
176
|
+
|
177
|
+
### `token_endpoint`
|
178
|
+
|
179
|
+
**The token URL path for OAuth authentication.**
|
180
|
+
|
181
|
+
* Defaults to Salesforce's `.well-known/openid-configuration` for *token* endpoint
|
182
|
+
* Should start with a **leading slash**, e.g., `/services/oauth2/token`
|
183
|
+
* No customization is typical, but internal designs may use custom ApexRest endpoints
|
184
|
+
"""
|
185
|
+
|
113
186
|
self.access_token = access_token
|
187
|
+
"""
|
188
|
+
|
189
|
+
### `access_token`
|
190
|
+
|
191
|
+
**The current OAuth access token.**
|
192
|
+
|
193
|
+
* Used to authorize API requests
|
194
|
+
* Does not include Bearer prefix, strictly the token
|
195
|
+
"""
|
196
|
+
|
114
197
|
self.token_expiration_time = token_expiration_time
|
198
|
+
"""
|
199
|
+
|
200
|
+
### `token_expiration_time`
|
201
|
+
|
202
|
+
**Unix timestamp (in seconds) for access token expiration.**
|
203
|
+
|
204
|
+
* Managed automatically by the library
|
205
|
+
* Useful for checking when to refresh the token
|
206
|
+
"""
|
207
|
+
|
115
208
|
self.token_lifetime = token_lifetime
|
209
|
+
"""
|
210
|
+
|
211
|
+
### `token_lifetime`
|
212
|
+
|
213
|
+
**Access token lifespan in seconds.**
|
214
|
+
|
215
|
+
* Determined by your Connected App's session policies
|
216
|
+
* Used to calculate when to refresh the token
|
217
|
+
"""
|
218
|
+
|
116
219
|
self.user_agent = user_agent
|
220
|
+
"""
|
221
|
+
|
222
|
+
### `user_agent`
|
223
|
+
|
224
|
+
**Custom User-Agent string for API calls.**
|
225
|
+
|
226
|
+
* Included in HTTP request headers
|
227
|
+
* Useful for identifying traffic in Salesforce `ApiEvent` logs
|
228
|
+
"""
|
229
|
+
|
117
230
|
self.sforce_client = str(sforce_client).replace(",", "")
|
231
|
+
"""
|
232
|
+
|
233
|
+
### `sforce_client`
|
234
|
+
|
235
|
+
**Custom application identifier.**
|
236
|
+
|
237
|
+
* Included in the `Sforce-Call-Options` header
|
238
|
+
* Useful for identifying traffic in Event Log Files
|
239
|
+
* Commas are not allowed; will be stripped
|
240
|
+
"""
|
241
|
+
|
118
242
|
self._auto_configure_proxy(proxy)
|
119
243
|
self._high_api_usage_threshold = 80
|
120
244
|
|
@@ -0,0 +1,6 @@
|
|
1
|
+
sfq/__init__.py,sha256=CGy6GEwN2jVCVefxqZADkiNGEVoQ6r82RE12avvu1u4,37139
|
2
|
+
sfq/_cometd.py,sha256=XimQEubmJwUmbWe85TxH_cuhGvWVuiHHrVr41tguuiI,10508
|
3
|
+
sfq/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
+
sfq-0.0.23.dist-info/METADATA,sha256=JOC_058SI4a80XDvM5z0cEquinZ92uwLl7my19w4czQ,6899
|
5
|
+
sfq-0.0.23.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
6
|
+
sfq-0.0.23.dist-info/RECORD,,
|
sfq-0.0.22.dist-info/RECORD
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
sfq/__init__.py,sha256=3x3j9v4Ci-9i7DWwb37aNnj9ax9EkYATlegQXhm9ULA,34049
|
2
|
-
sfq/_cometd.py,sha256=XimQEubmJwUmbWe85TxH_cuhGvWVuiHHrVr41tguuiI,10508
|
3
|
-
sfq/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
-
sfq-0.0.22.dist-info/METADATA,sha256=imWhA2wmY5qhLT7F3Z5PX8eQNWQ20evnNMFz1CkORJc,6899
|
5
|
-
sfq-0.0.22.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
6
|
-
sfq-0.0.22.dist-info/RECORD,,
|
File without changes
|