intuned-client 0.4.1__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.
- intuned_client-0.4.1/PKG-INFO +883 -0
- intuned_client-0.4.1/README.md +872 -0
- intuned_client-0.4.1/pyproject.toml +52 -0
- intuned_client-0.4.1/setup.cfg +4 -0
- intuned_client-0.4.1/src/intuned_client/__init__.py +17 -0
- intuned_client-0.4.1/src/intuned_client/_hooks/__init__.py +4 -0
- intuned_client-0.4.1/src/intuned_client/_hooks/sdkhooks.py +74 -0
- intuned_client-0.4.1/src/intuned_client/_hooks/types.py +112 -0
- intuned_client-0.4.1/src/intuned_client/_version.py +15 -0
- intuned_client-0.4.1/src/intuned_client/authsessions.py +592 -0
- intuned_client-0.4.1/src/intuned_client/basesdk.py +368 -0
- intuned_client-0.4.1/src/intuned_client/create.py +441 -0
- intuned_client-0.4.1/src/intuned_client/errors/__init__.py +251 -0
- intuned_client-0.4.1/src/intuned_client/errors/createjobop.py +125 -0
- intuned_client-0.4.1/src/intuned_client/errors/deletejobop.py +87 -0
- intuned_client-0.4.1/src/intuned_client/errors/getjobop.py +125 -0
- intuned_client-0.4.1/src/intuned_client/errors/getjobrunop.py +125 -0
- intuned_client-0.4.1/src/intuned_client/errors/getjobrunsop.py +125 -0
- intuned_client-0.4.1/src/intuned_client/errors/getjobsop.py +125 -0
- intuned_client-0.4.1/src/intuned_client/errors/intunedclientdefaulterror.py +40 -0
- intuned_client-0.4.1/src/intuned_client/errors/intunedclienterror.py +30 -0
- intuned_client-0.4.1/src/intuned_client/errors/no_response_error.py +17 -0
- intuned_client-0.4.1/src/intuned_client/errors/pausejobop.py +125 -0
- intuned_client-0.4.1/src/intuned_client/errors/responsevalidationerror.py +27 -0
- intuned_client-0.4.1/src/intuned_client/errors/resumejobop.py +125 -0
- intuned_client-0.4.1/src/intuned_client/errors/terminatejobrunop.py +87 -0
- intuned_client-0.4.1/src/intuned_client/errors/triggerjobop.py +125 -0
- intuned_client-0.4.1/src/intuned_client/httpclient.py +125 -0
- intuned_client-0.4.1/src/intuned_client/jobs.py +1624 -0
- intuned_client-0.4.1/src/intuned_client/models/__init__.py +2350 -0
- intuned_client-0.4.1/src/intuned_client/models/createauthsessionresultop.py +241 -0
- intuned_client-0.4.1/src/intuned_client/models/createjobop.py +1408 -0
- intuned_client-0.4.1/src/intuned_client/models/createorupdateauthsessionstartop.py +144 -0
- intuned_client-0.4.1/src/intuned_client/models/deleteauthsessionop.py +45 -0
- intuned_client-0.4.1/src/intuned_client/models/deletejobop.py +69 -0
- intuned_client-0.4.1/src/intuned_client/models/getauthsessionop.py +79 -0
- intuned_client-0.4.1/src/intuned_client/models/getauthsessionsop.py +66 -0
- intuned_client-0.4.1/src/intuned_client/models/getjobop.py +1411 -0
- intuned_client-0.4.1/src/intuned_client/models/getjobrunop.py +627 -0
- intuned_client-0.4.1/src/intuned_client/models/getjobrunsop.py +621 -0
- intuned_client-0.4.1/src/intuned_client/models/getjobsop.py +1493 -0
- intuned_client-0.4.1/src/intuned_client/models/internal/__init__.py +54 -0
- intuned_client-0.4.1/src/intuned_client/models/internal/globals.py +22 -0
- intuned_client-0.4.1/src/intuned_client/models/pausejobop.py +96 -0
- intuned_client-0.4.1/src/intuned_client/models/resumejobop.py +96 -0
- intuned_client-0.4.1/src/intuned_client/models/runapiresultop.py +208 -0
- intuned_client-0.4.1/src/intuned_client/models/runapistartop.py +473 -0
- intuned_client-0.4.1/src/intuned_client/models/security.py +25 -0
- intuned_client-0.4.1/src/intuned_client/models/startauthsessionrecorderop.py +75 -0
- intuned_client-0.4.1/src/intuned_client/models/terminatejobrunop.py +92 -0
- intuned_client-0.4.1/src/intuned_client/models/triggerjobop.py +100 -0
- intuned_client-0.4.1/src/intuned_client/models/updateauthsessionresultop.py +250 -0
- intuned_client-0.4.1/src/intuned_client/models/updateauthsessionstartop.py +142 -0
- intuned_client-0.4.1/src/intuned_client/project.py +31 -0
- intuned_client-0.4.1/src/intuned_client/py.typed +1 -0
- intuned_client-0.4.1/src/intuned_client/recorder.py +227 -0
- intuned_client-0.4.1/src/intuned_client/run.py +465 -0
- intuned_client-0.4.1/src/intuned_client/runs.py +687 -0
- intuned_client-0.4.1/src/intuned_client/sdk.py +188 -0
- intuned_client-0.4.1/src/intuned_client/sdkconfiguration.py +51 -0
- intuned_client-0.4.1/src/intuned_client/types/__init__.py +21 -0
- intuned_client-0.4.1/src/intuned_client/types/basemodel.py +39 -0
- intuned_client-0.4.1/src/intuned_client/update.py +447 -0
- intuned_client-0.4.1/src/intuned_client/utils/__init__.py +200 -0
- intuned_client-0.4.1/src/intuned_client/utils/annotations.py +79 -0
- intuned_client-0.4.1/src/intuned_client/utils/datetimes.py +23 -0
- intuned_client-0.4.1/src/intuned_client/utils/enums.py +74 -0
- intuned_client-0.4.1/src/intuned_client/utils/eventstreaming.py +248 -0
- intuned_client-0.4.1/src/intuned_client/utils/forms.py +223 -0
- intuned_client-0.4.1/src/intuned_client/utils/headers.py +136 -0
- intuned_client-0.4.1/src/intuned_client/utils/logger.py +27 -0
- intuned_client-0.4.1/src/intuned_client/utils/metadata.py +118 -0
- intuned_client-0.4.1/src/intuned_client/utils/queryparams.py +205 -0
- intuned_client-0.4.1/src/intuned_client/utils/requestbodies.py +66 -0
- intuned_client-0.4.1/src/intuned_client/utils/retries.py +217 -0
- intuned_client-0.4.1/src/intuned_client/utils/security.py +192 -0
- intuned_client-0.4.1/src/intuned_client/utils/serializers.py +249 -0
- intuned_client-0.4.1/src/intuned_client/utils/unmarshal_json_response.py +24 -0
- intuned_client-0.4.1/src/intuned_client/utils/url.py +155 -0
- intuned_client-0.4.1/src/intuned_client/utils/values.py +137 -0
- intuned_client-0.4.1/src/intuned_client.egg-info/PKG-INFO +883 -0
- intuned_client-0.4.1/src/intuned_client.egg-info/SOURCES.txt +83 -0
- intuned_client-0.4.1/src/intuned_client.egg-info/dependency_links.txt +1 -0
- intuned_client-0.4.1/src/intuned_client.egg-info/requires.txt +3 -0
- intuned_client-0.4.1/src/intuned_client.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,883 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: intuned-client
|
|
3
|
+
Version: 0.4.1
|
|
4
|
+
Summary: Python Client SDK Generated by Speakeasy.
|
|
5
|
+
Author: Speakeasy
|
|
6
|
+
Requires-Python: >=3.9.2
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: httpcore>=1.0.9
|
|
9
|
+
Requires-Dist: httpx>=0.28.1
|
|
10
|
+
Requires-Dist: pydantic>=2.11.2
|
|
11
|
+
|
|
12
|
+
# intuned-client
|
|
13
|
+
|
|
14
|
+
Developer-friendly & type-safe Python SDK specifically catered to leverage *intuned-client* API.
|
|
15
|
+
|
|
16
|
+
<div align="left" style="margin-bottom: 0;">
|
|
17
|
+
<a href="https://www.speakeasy.com/?utm_source=intuned-client&utm_campaign=python" class="badge-link">
|
|
18
|
+
<span class="badge-container">
|
|
19
|
+
<span class="badge-icon-section">
|
|
20
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 30 30" fill="none" style="vertical-align: middle;"><title>Speakeasy Logo</title><path fill="currentColor" d="m20.639 27.548-19.17-2.724L0 26.1l20.639 2.931 8.456-7.336-1.468-.208-6.988 6.062Z"></path><path fill="currentColor" d="m20.639 23.1 8.456-7.336-1.468-.207-6.988 6.06-6.84-.972-9.394-1.333-2.936-.417L0 20.169l2.937.416L0 23.132l20.639 2.931 8.456-7.334-1.468-.208-6.986 6.062-9.78-1.39 1.468-1.273 8.31 1.18Z"></path><path fill="currentColor" d="m20.639 18.65-19.17-2.724L0 17.201l20.639 2.931 8.456-7.334-1.468-.208-6.988 6.06Z"></path><path fill="currentColor" d="M27.627 6.658 24.69 9.205 20.64 12.72l-7.923-1.126L1.469 9.996 0 11.271l11.246 1.596-1.467 1.275-8.311-1.181L0 14.235l20.639 2.932 8.456-7.334-2.937-.418 2.937-2.549-1.468-.208Z"></path><path fill="currentColor" d="M29.095 3.902 8.456.971 0 8.305l20.639 2.934 8.456-7.337Z"></path></svg>
|
|
21
|
+
</span>
|
|
22
|
+
<span class="badge-text badge-text-section">BUILT BY SPEAKEASY</span>
|
|
23
|
+
</span>
|
|
24
|
+
</a>
|
|
25
|
+
<a href="https://opensource.org/licenses/MIT" class="badge-link">
|
|
26
|
+
<span class="badge-container blue">
|
|
27
|
+
<span class="badge-text badge-text-section">LICENSE // MIT</span>
|
|
28
|
+
</span>
|
|
29
|
+
</a>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
<br /><br />
|
|
34
|
+
|
|
35
|
+
<!-- Start Summary [summary] -->
|
|
36
|
+
## Summary
|
|
37
|
+
|
|
38
|
+
Intuned Client: Intuned API Client to call APIs exposed by the Intuned Platform (https://docs.intunedhq.com/).
|
|
39
|
+
|
|
40
|
+
For more information about the API: [Find out more about Intuned](https://docs.intunedhq.com/)
|
|
41
|
+
<!-- End Summary [summary] -->
|
|
42
|
+
|
|
43
|
+
<!-- Start Table of Contents [toc] -->
|
|
44
|
+
## Table of Contents
|
|
45
|
+
<!-- $toc-max-depth=2 -->
|
|
46
|
+
* [intuned-client](#intuned-client)
|
|
47
|
+
* [SDK Installation](#sdk-installation)
|
|
48
|
+
* [IDE Support](#ide-support)
|
|
49
|
+
* [SDK Example Usage](#sdk-example-usage)
|
|
50
|
+
* [Authentication](#authentication)
|
|
51
|
+
* [Available Resources and Operations](#available-resources-and-operations)
|
|
52
|
+
* [Global Parameters](#global-parameters)
|
|
53
|
+
* [Retries](#retries)
|
|
54
|
+
* [Error Handling](#error-handling)
|
|
55
|
+
* [Server Selection](#server-selection)
|
|
56
|
+
* [Custom HTTP Client](#custom-http-client)
|
|
57
|
+
* [Resource Management](#resource-management)
|
|
58
|
+
* [Debugging](#debugging)
|
|
59
|
+
* [Development](#development)
|
|
60
|
+
* [Maturity](#maturity)
|
|
61
|
+
* [Contributions](#contributions)
|
|
62
|
+
|
|
63
|
+
<!-- End Table of Contents [toc] -->
|
|
64
|
+
|
|
65
|
+
<!-- Start SDK Installation [installation] -->
|
|
66
|
+
## SDK Installation
|
|
67
|
+
|
|
68
|
+
> [!TIP]
|
|
69
|
+
> To finish publishing your SDK to PyPI you must [run your first generation action](https://www.speakeasy.com/docs/github-setup#step-by-step-guide).
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
> [!NOTE]
|
|
73
|
+
> **Python version upgrade policy**
|
|
74
|
+
>
|
|
75
|
+
> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
|
|
76
|
+
|
|
77
|
+
The SDK can be installed with *uv*, *pip*, or *poetry* package managers.
|
|
78
|
+
|
|
79
|
+
### uv
|
|
80
|
+
|
|
81
|
+
*uv* is a fast Python package installer and resolver, designed as a drop-in replacement for pip and pip-tools. It's recommended for its speed and modern Python tooling capabilities.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
uv add git+<UNSET>.git
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### PIP
|
|
88
|
+
|
|
89
|
+
*PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pip install git+<UNSET>.git
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Poetry
|
|
96
|
+
|
|
97
|
+
*Poetry* is a modern tool that simplifies dependency management and package publishing by using a single `pyproject.toml` file to handle project metadata and dependencies.
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
poetry add git+<UNSET>.git
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Shell and script usage with `uv`
|
|
104
|
+
|
|
105
|
+
You can use this SDK in a Python shell with [uv](https://docs.astral.sh/uv/) and the `uvx` command that comes with it like so:
|
|
106
|
+
|
|
107
|
+
```shell
|
|
108
|
+
uvx --from intuned-client python
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
It's also possible to write a standalone Python script without needing to set up a whole project like so:
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
#!/usr/bin/env -S uv run --script
|
|
115
|
+
# /// script
|
|
116
|
+
# requires-python = ">=3.9"
|
|
117
|
+
# dependencies = [
|
|
118
|
+
# "intuned-client",
|
|
119
|
+
# ]
|
|
120
|
+
# ///
|
|
121
|
+
|
|
122
|
+
from intuned_client import IntunedClient
|
|
123
|
+
|
|
124
|
+
sdk = IntunedClient(
|
|
125
|
+
# SDK arguments
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
# Rest of script here...
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Once that is saved to a file, you can run it with `uv run script.py` where
|
|
132
|
+
`script.py` can be replaced with the actual file name.
|
|
133
|
+
<!-- End SDK Installation [installation] -->
|
|
134
|
+
|
|
135
|
+
<!-- Start IDE Support [idesupport] -->
|
|
136
|
+
## IDE Support
|
|
137
|
+
|
|
138
|
+
### PyCharm
|
|
139
|
+
|
|
140
|
+
Generally, the SDK will work well with most IDEs out of the box. However, when using PyCharm, you can enjoy much better integration with Pydantic by installing an additional plugin.
|
|
141
|
+
|
|
142
|
+
- [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/)
|
|
143
|
+
<!-- End IDE Support [idesupport] -->
|
|
144
|
+
|
|
145
|
+
<!-- Start SDK Example Usage [usage] -->
|
|
146
|
+
## SDK Example Usage
|
|
147
|
+
|
|
148
|
+
### Example
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
# Synchronous Example
|
|
152
|
+
from intuned_client import IntunedClient
|
|
153
|
+
import os
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
with IntunedClient(
|
|
157
|
+
workspace_id="123e4567-e89b-12d3-a456-426614174000",
|
|
158
|
+
api_key=os.getenv("INTUNED_API_KEY", ""),
|
|
159
|
+
) as ic_client:
|
|
160
|
+
|
|
161
|
+
res = ic_client.project.run.start(project_name="my-project", parameters={
|
|
162
|
+
"param1": "value1",
|
|
163
|
+
"param2": 42,
|
|
164
|
+
"param3": True,
|
|
165
|
+
}, api="my-awesome-api", proxy="http://username:password@domain:port", save_trace=True, request_timeout=600, retry={}, auth_session={
|
|
166
|
+
"id": "auth-session-123",
|
|
167
|
+
"auto_recreate": True,
|
|
168
|
+
"check_attempts": 3,
|
|
169
|
+
"create_attempts": 3,
|
|
170
|
+
"proxy": "http://username:password@domain:port",
|
|
171
|
+
"request_timeout": 600,
|
|
172
|
+
}, sink={
|
|
173
|
+
"type": "webhook",
|
|
174
|
+
"url": "https://example.com/webhook",
|
|
175
|
+
"headers": {
|
|
176
|
+
"Content-Type": "application/json",
|
|
177
|
+
"Authorization": "Bearer token",
|
|
178
|
+
},
|
|
179
|
+
"skip_on_fail": False,
|
|
180
|
+
"apis_to_send": [
|
|
181
|
+
"api1",
|
|
182
|
+
"api2",
|
|
183
|
+
],
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
# Handle response
|
|
187
|
+
print(res)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
</br>
|
|
191
|
+
|
|
192
|
+
The same SDK client can also be used to make asynchronous requests by importing asyncio.
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
# Asynchronous Example
|
|
196
|
+
import asyncio
|
|
197
|
+
from intuned_client import IntunedClient
|
|
198
|
+
import os
|
|
199
|
+
|
|
200
|
+
async def main():
|
|
201
|
+
|
|
202
|
+
async with IntunedClient(
|
|
203
|
+
workspace_id="123e4567-e89b-12d3-a456-426614174000",
|
|
204
|
+
api_key=os.getenv("INTUNED_API_KEY", ""),
|
|
205
|
+
) as ic_client:
|
|
206
|
+
|
|
207
|
+
res = await ic_client.project.run.start_async(project_name="my-project", parameters={
|
|
208
|
+
"param1": "value1",
|
|
209
|
+
"param2": 42,
|
|
210
|
+
"param3": True,
|
|
211
|
+
}, api="my-awesome-api", proxy="http://username:password@domain:port", save_trace=True, request_timeout=600, retry={}, auth_session={
|
|
212
|
+
"auto_recreate": True,
|
|
213
|
+
"check_attempts": 3,
|
|
214
|
+
"create_attempts": 3,
|
|
215
|
+
"proxy": "http://username:password@domain:port",
|
|
216
|
+
"request_timeout": 600,
|
|
217
|
+
"runtime_input": {
|
|
218
|
+
"username": "user",
|
|
219
|
+
"password": "pass",
|
|
220
|
+
},
|
|
221
|
+
}, sink={
|
|
222
|
+
"type": "s3",
|
|
223
|
+
"bucket": "my-s3-bucket",
|
|
224
|
+
"access_key_id": "AKIAIOSFODNN7EXSSPLE",
|
|
225
|
+
"secret_access_key": "wJalrXUtnFFFI/K7MDENG/bPxRfiCYEXAMPLEKEY",
|
|
226
|
+
"region": "us-west-2",
|
|
227
|
+
"prefix": "my-prefix/",
|
|
228
|
+
"skip_on_fail": False,
|
|
229
|
+
"apis_to_send": [
|
|
230
|
+
"api1",
|
|
231
|
+
"api2",
|
|
232
|
+
],
|
|
233
|
+
"endpoint": "https://s3.custom-endpoint.com",
|
|
234
|
+
"force_path_style": True,
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
# Handle response
|
|
238
|
+
print(res)
|
|
239
|
+
|
|
240
|
+
asyncio.run(main())
|
|
241
|
+
```
|
|
242
|
+
<!-- End SDK Example Usage [usage] -->
|
|
243
|
+
|
|
244
|
+
<!-- Start Authentication [security] -->
|
|
245
|
+
## Authentication
|
|
246
|
+
|
|
247
|
+
### Per-Client Security Schemes
|
|
248
|
+
|
|
249
|
+
This SDK supports the following security scheme globally:
|
|
250
|
+
|
|
251
|
+
| Name | Type | Scheme | Environment Variable |
|
|
252
|
+
| --------- | ------ | ------- | -------------------- |
|
|
253
|
+
| `api_key` | apiKey | API key | `INTUNED_API_KEY` |
|
|
254
|
+
|
|
255
|
+
To authenticate with the API the `api_key` parameter must be set when initializing the SDK client instance. For example:
|
|
256
|
+
```python
|
|
257
|
+
from intuned_client import IntunedClient
|
|
258
|
+
import os
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
with IntunedClient(
|
|
262
|
+
api_key=os.getenv("INTUNED_API_KEY", ""),
|
|
263
|
+
workspace_id="123e4567-e89b-12d3-a456-426614174000",
|
|
264
|
+
) as ic_client:
|
|
265
|
+
|
|
266
|
+
res = ic_client.project.run.start(project_name="my-project", parameters={
|
|
267
|
+
"param1": "value1",
|
|
268
|
+
"param2": 42,
|
|
269
|
+
"param3": True,
|
|
270
|
+
}, api="my-awesome-api", proxy="http://username:password@domain:port", save_trace=True, request_timeout=600, retry={}, auth_session={
|
|
271
|
+
"id": "auth-session-123",
|
|
272
|
+
"auto_recreate": True,
|
|
273
|
+
"check_attempts": 3,
|
|
274
|
+
"create_attempts": 3,
|
|
275
|
+
"proxy": "http://username:password@domain:port",
|
|
276
|
+
"request_timeout": 600,
|
|
277
|
+
}, sink={
|
|
278
|
+
"type": "webhook",
|
|
279
|
+
"url": "https://example.com/webhook",
|
|
280
|
+
"headers": {
|
|
281
|
+
"Content-Type": "application/json",
|
|
282
|
+
"Authorization": "Bearer token",
|
|
283
|
+
},
|
|
284
|
+
"skip_on_fail": False,
|
|
285
|
+
"apis_to_send": [
|
|
286
|
+
"api1",
|
|
287
|
+
"api2",
|
|
288
|
+
],
|
|
289
|
+
})
|
|
290
|
+
|
|
291
|
+
# Handle response
|
|
292
|
+
print(res)
|
|
293
|
+
|
|
294
|
+
```
|
|
295
|
+
<!-- End Authentication [security] -->
|
|
296
|
+
|
|
297
|
+
<!-- Start Available Resources and Operations [operations] -->
|
|
298
|
+
## Available Resources and Operations
|
|
299
|
+
|
|
300
|
+
<details open>
|
|
301
|
+
<summary>Available methods</summary>
|
|
302
|
+
|
|
303
|
+
#### [project.auth_sessions](docs/sdks/authsessions/README.md)
|
|
304
|
+
|
|
305
|
+
* [all](docs/sdks/authsessions/README.md#all) - Get Auth Sessions
|
|
306
|
+
* [one](docs/sdks/authsessions/README.md#one) - Get Auth Session
|
|
307
|
+
* [delete](docs/sdks/authsessions/README.md#delete) - Delete Auth Session
|
|
308
|
+
|
|
309
|
+
#### [project.auth_sessions.create](docs/sdks/create/README.md)
|
|
310
|
+
|
|
311
|
+
* [start](docs/sdks/create/README.md#start) - Create Auth Session - Start
|
|
312
|
+
* [result](docs/sdks/create/README.md#result) - Create Auth Session - Result
|
|
313
|
+
|
|
314
|
+
#### [project.auth_sessions.recorder](docs/sdks/recorder/README.md)
|
|
315
|
+
|
|
316
|
+
* [start](docs/sdks/recorder/README.md#start) - Start recorder session for an auth session
|
|
317
|
+
|
|
318
|
+
#### [project.auth_sessions.update](docs/sdks/update/README.md)
|
|
319
|
+
|
|
320
|
+
* [start](docs/sdks/update/README.md#start) - Update Auth Session - Start
|
|
321
|
+
* [result](docs/sdks/update/README.md#result) - Update Auth Session - Result
|
|
322
|
+
|
|
323
|
+
#### [project.jobs](docs/sdks/jobs/README.md)
|
|
324
|
+
|
|
325
|
+
* [all](docs/sdks/jobs/README.md#all) - Get Jobs
|
|
326
|
+
* [create](docs/sdks/jobs/README.md#create) - Create Job
|
|
327
|
+
* [one](docs/sdks/jobs/README.md#one) - Get Job
|
|
328
|
+
* [delete](docs/sdks/jobs/README.md#delete) - Delete Job
|
|
329
|
+
* [pause](docs/sdks/jobs/README.md#pause) - Pause Job
|
|
330
|
+
* [resume](docs/sdks/jobs/README.md#resume) - Resume Job
|
|
331
|
+
* [trigger](docs/sdks/jobs/README.md#trigger) - Trigger Job
|
|
332
|
+
|
|
333
|
+
#### [project.jobs.runs](docs/sdks/runs/README.md)
|
|
334
|
+
|
|
335
|
+
* [all](docs/sdks/runs/README.md#all) - Get Job Runs
|
|
336
|
+
* [one](docs/sdks/runs/README.md#one) - Get Job Run
|
|
337
|
+
* [terminate](docs/sdks/runs/README.md#terminate) - Terminate Job Run
|
|
338
|
+
|
|
339
|
+
#### [project.run](docs/sdks/run/README.md)
|
|
340
|
+
|
|
341
|
+
* [start](docs/sdks/run/README.md#start) - Run API - Async Start
|
|
342
|
+
* [result](docs/sdks/run/README.md#result) - Run API - Async Result
|
|
343
|
+
|
|
344
|
+
</details>
|
|
345
|
+
<!-- End Available Resources and Operations [operations] -->
|
|
346
|
+
|
|
347
|
+
<!-- Start Global Parameters [global-parameters] -->
|
|
348
|
+
## Global Parameters
|
|
349
|
+
|
|
350
|
+
A parameter is configured globally. This parameter may be set on the SDK client instance itself during initialization. When configured as an option during SDK initialization, This global value will be used as the default on the operations that use it. When such operations are called, there is a place in each to override the global value, if needed.
|
|
351
|
+
|
|
352
|
+
For example, you can set `workspaceId` to `"123e4567-e89b-12d3-a456-426614174000"` at SDK initialization and then you do not have to pass the same value on calls to operations like `start`. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration.
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
### Available Globals
|
|
356
|
+
|
|
357
|
+
The following global parameter is available.
|
|
358
|
+
Global parameters can also be set via environment variable.
|
|
359
|
+
|
|
360
|
+
| Name | Type | Description | Environment |
|
|
361
|
+
| ------------ | ---- | ------------------------------------------------------------------------------------ | -------------------- |
|
|
362
|
+
| workspace_id | str | Your workspace ID. [How to find it](/docs/guides/general/how-to-get-a-workspace-id)? | INTUNED_WORKSPACE_ID |
|
|
363
|
+
|
|
364
|
+
### Example
|
|
365
|
+
|
|
366
|
+
```python
|
|
367
|
+
from intuned_client import IntunedClient
|
|
368
|
+
import os
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
with IntunedClient(
|
|
372
|
+
workspace_id="123e4567-e89b-12d3-a456-426614174000",
|
|
373
|
+
api_key=os.getenv("INTUNED_API_KEY", ""),
|
|
374
|
+
) as ic_client:
|
|
375
|
+
|
|
376
|
+
res = ic_client.project.run.start(project_name="my-project", parameters={
|
|
377
|
+
"param1": "value1",
|
|
378
|
+
"param2": 42,
|
|
379
|
+
"param3": True,
|
|
380
|
+
}, api="my-awesome-api", proxy="http://username:password@domain:port", save_trace=True, request_timeout=600, retry={}, auth_session={
|
|
381
|
+
"id": "auth-session-123",
|
|
382
|
+
"auto_recreate": True,
|
|
383
|
+
"check_attempts": 3,
|
|
384
|
+
"create_attempts": 3,
|
|
385
|
+
"proxy": "http://username:password@domain:port",
|
|
386
|
+
"request_timeout": 600,
|
|
387
|
+
}, sink={
|
|
388
|
+
"type": "webhook",
|
|
389
|
+
"url": "https://example.com/webhook",
|
|
390
|
+
"headers": {
|
|
391
|
+
"Content-Type": "application/json",
|
|
392
|
+
"Authorization": "Bearer token",
|
|
393
|
+
},
|
|
394
|
+
"skip_on_fail": False,
|
|
395
|
+
"apis_to_send": [
|
|
396
|
+
"api1",
|
|
397
|
+
"api2",
|
|
398
|
+
],
|
|
399
|
+
})
|
|
400
|
+
|
|
401
|
+
# Handle response
|
|
402
|
+
print(res)
|
|
403
|
+
|
|
404
|
+
```
|
|
405
|
+
<!-- End Global Parameters [global-parameters] -->
|
|
406
|
+
|
|
407
|
+
<!-- Start Retries [retries] -->
|
|
408
|
+
## Retries
|
|
409
|
+
|
|
410
|
+
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
|
|
411
|
+
|
|
412
|
+
To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
|
|
413
|
+
```python
|
|
414
|
+
from intuned_client import IntunedClient
|
|
415
|
+
from intuned_client.utils import BackoffStrategy, RetryConfig
|
|
416
|
+
import os
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
with IntunedClient(
|
|
420
|
+
workspace_id="123e4567-e89b-12d3-a456-426614174000",
|
|
421
|
+
api_key=os.getenv("INTUNED_API_KEY", ""),
|
|
422
|
+
) as ic_client:
|
|
423
|
+
|
|
424
|
+
res = ic_client.project.run.start(project_name="my-project", parameters={
|
|
425
|
+
"param1": "value1",
|
|
426
|
+
"param2": 42,
|
|
427
|
+
"param3": True,
|
|
428
|
+
}, api="my-awesome-api", proxy="http://username:password@domain:port", save_trace=True, request_timeout=600, retry={}, auth_session={
|
|
429
|
+
"id": "auth-session-123",
|
|
430
|
+
"auto_recreate": True,
|
|
431
|
+
"check_attempts": 3,
|
|
432
|
+
"create_attempts": 3,
|
|
433
|
+
"proxy": "http://username:password@domain:port",
|
|
434
|
+
"request_timeout": 600,
|
|
435
|
+
}, sink={
|
|
436
|
+
"type": "webhook",
|
|
437
|
+
"url": "https://example.com/webhook",
|
|
438
|
+
"headers": {
|
|
439
|
+
"Content-Type": "application/json",
|
|
440
|
+
"Authorization": "Bearer token",
|
|
441
|
+
},
|
|
442
|
+
"skip_on_fail": False,
|
|
443
|
+
"apis_to_send": [
|
|
444
|
+
"api1",
|
|
445
|
+
"api2",
|
|
446
|
+
],
|
|
447
|
+
},
|
|
448
|
+
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
|
|
449
|
+
|
|
450
|
+
# Handle response
|
|
451
|
+
print(res)
|
|
452
|
+
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
If you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK:
|
|
456
|
+
```python
|
|
457
|
+
from intuned_client import IntunedClient
|
|
458
|
+
from intuned_client.utils import BackoffStrategy, RetryConfig
|
|
459
|
+
import os
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
with IntunedClient(
|
|
463
|
+
retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
|
|
464
|
+
workspace_id="123e4567-e89b-12d3-a456-426614174000",
|
|
465
|
+
api_key=os.getenv("INTUNED_API_KEY", ""),
|
|
466
|
+
) as ic_client:
|
|
467
|
+
|
|
468
|
+
res = ic_client.project.run.start(project_name="my-project", parameters={
|
|
469
|
+
"param1": "value1",
|
|
470
|
+
"param2": 42,
|
|
471
|
+
"param3": True,
|
|
472
|
+
}, api="my-awesome-api", proxy="http://username:password@domain:port", save_trace=True, request_timeout=600, retry={}, auth_session={
|
|
473
|
+
"id": "auth-session-123",
|
|
474
|
+
"auto_recreate": True,
|
|
475
|
+
"check_attempts": 3,
|
|
476
|
+
"create_attempts": 3,
|
|
477
|
+
"proxy": "http://username:password@domain:port",
|
|
478
|
+
"request_timeout": 600,
|
|
479
|
+
}, sink={
|
|
480
|
+
"type": "webhook",
|
|
481
|
+
"url": "https://example.com/webhook",
|
|
482
|
+
"headers": {
|
|
483
|
+
"Content-Type": "application/json",
|
|
484
|
+
"Authorization": "Bearer token",
|
|
485
|
+
},
|
|
486
|
+
"skip_on_fail": False,
|
|
487
|
+
"apis_to_send": [
|
|
488
|
+
"api1",
|
|
489
|
+
"api2",
|
|
490
|
+
],
|
|
491
|
+
})
|
|
492
|
+
|
|
493
|
+
# Handle response
|
|
494
|
+
print(res)
|
|
495
|
+
|
|
496
|
+
```
|
|
497
|
+
<!-- End Retries [retries] -->
|
|
498
|
+
|
|
499
|
+
<!-- Start Error Handling [errors] -->
|
|
500
|
+
## Error Handling
|
|
501
|
+
|
|
502
|
+
[`IntunedClientError`](./src/intuned_client/errors/intunedclienterror.py) is the base class for all HTTP error responses. It has the following properties:
|
|
503
|
+
|
|
504
|
+
| Property | Type | Description |
|
|
505
|
+
| ------------------ | ---------------- | --------------------------------------------------------------------------------------- |
|
|
506
|
+
| `err.message` | `str` | Error message |
|
|
507
|
+
| `err.status_code` | `int` | HTTP response status code eg `404` |
|
|
508
|
+
| `err.headers` | `httpx.Headers` | HTTP response headers |
|
|
509
|
+
| `err.body` | `str` | HTTP body. Can be empty string if no body is returned. |
|
|
510
|
+
| `err.raw_response` | `httpx.Response` | Raw HTTP response |
|
|
511
|
+
| `err.data` | | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). |
|
|
512
|
+
|
|
513
|
+
### Example
|
|
514
|
+
```python
|
|
515
|
+
from intuned_client import IntunedClient, errors
|
|
516
|
+
import os
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
with IntunedClient(
|
|
520
|
+
workspace_id="123e4567-e89b-12d3-a456-426614174000",
|
|
521
|
+
api_key=os.getenv("INTUNED_API_KEY", ""),
|
|
522
|
+
) as ic_client:
|
|
523
|
+
res = None
|
|
524
|
+
try:
|
|
525
|
+
|
|
526
|
+
res = ic_client.project.jobs.all(project_name="my-project")
|
|
527
|
+
|
|
528
|
+
# Handle response
|
|
529
|
+
print(res)
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
except errors.IntunedClientError as e:
|
|
533
|
+
# The base class for HTTP error responses
|
|
534
|
+
print(e.message)
|
|
535
|
+
print(e.status_code)
|
|
536
|
+
print(e.body)
|
|
537
|
+
print(e.headers)
|
|
538
|
+
print(e.raw_response)
|
|
539
|
+
|
|
540
|
+
# Depending on the method different errors may be thrown
|
|
541
|
+
if isinstance(e, errors.GetJobsBadRequestUserError):
|
|
542
|
+
print(e.data.code) # models.GetJobsBadRequestCode
|
|
543
|
+
print(e.data.category) # models.GetJobsBadRequestCategory
|
|
544
|
+
print(e.data.message) # str
|
|
545
|
+
print(e.data.retirable) # bool
|
|
546
|
+
print(e.data.details) # Optional[Any]
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
### Error Classes
|
|
550
|
+
**Primary error:**
|
|
551
|
+
* [`IntunedClientError`](./src/intuned_client/errors/intunedclienterror.py): The base class for HTTP error responses.
|
|
552
|
+
|
|
553
|
+
<details><summary>Less common errors (33)</summary>
|
|
554
|
+
|
|
555
|
+
<br />
|
|
556
|
+
|
|
557
|
+
**Network errors:**
|
|
558
|
+
* [`httpx.RequestError`](https://www.python-httpx.org/exceptions/#httpx.RequestError): Base class for request errors.
|
|
559
|
+
* [`httpx.ConnectError`](https://www.python-httpx.org/exceptions/#httpx.ConnectError): HTTP client was unable to make a request to a server.
|
|
560
|
+
* [`httpx.TimeoutException`](https://www.python-httpx.org/exceptions/#httpx.TimeoutException): HTTP request timed out.
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
**Inherit from [`IntunedClientError`](./src/intuned_client/errors/intunedclienterror.py)**:
|
|
564
|
+
* [`GetJobsBadRequestUserError`](./src/intuned_client/errors/getjobsbadrequestusererror.py): Bad Request. Status code `400`. Applicable to 1 of 20 methods.*
|
|
565
|
+
* [`CreateJobBadRequestUserError`](./src/intuned_client/errors/createjobbadrequestusererror.py): Bad Request. Status code `400`. Applicable to 1 of 20 methods.*
|
|
566
|
+
* [`GetJobBadRequestUserError`](./src/intuned_client/errors/getjobbadrequestusererror.py): Bad Request. Status code `400`. Applicable to 1 of 20 methods.*
|
|
567
|
+
* [`PauseJobBadRequestUserError`](./src/intuned_client/errors/pausejobbadrequestusererror.py): Bad Request. Status code `400`. Applicable to 1 of 20 methods.*
|
|
568
|
+
* [`ResumeJobBadRequestUserError`](./src/intuned_client/errors/resumejobbadrequestusererror.py): Bad Request. Status code `400`. Applicable to 1 of 20 methods.*
|
|
569
|
+
* [`TriggerJobBadRequestUserError`](./src/intuned_client/errors/triggerjobbadrequestusererror.py): Bad Request. Status code `400`. Applicable to 1 of 20 methods.*
|
|
570
|
+
* [`GetJobRunsBadRequestUserError`](./src/intuned_client/errors/getjobrunsbadrequestusererror.py): Bad Request. Status code `400`. Applicable to 1 of 20 methods.*
|
|
571
|
+
* [`GetJobRunBadRequestUserError`](./src/intuned_client/errors/getjobrunbadrequestusererror.py): Bad Request. Status code `400`. Applicable to 1 of 20 methods.*
|
|
572
|
+
* [`GetJobsUnauthorizedUserError`](./src/intuned_client/errors/getjobsunauthorizedusererror.py): Unauthorized. Status code `401`. Applicable to 1 of 20 methods.*
|
|
573
|
+
* [`CreateJobUnauthorizedUserError`](./src/intuned_client/errors/createjobunauthorizedusererror.py): Unauthorized. Status code `401`. Applicable to 1 of 20 methods.*
|
|
574
|
+
* [`GetJobUnauthorizedUserError`](./src/intuned_client/errors/getjobunauthorizedusererror.py): Unauthorized. Status code `401`. Applicable to 1 of 20 methods.*
|
|
575
|
+
* [`DeleteJobUnauthorizedUserError`](./src/intuned_client/errors/deletejobunauthorizedusererror.py): Unauthorized. Status code `401`. Applicable to 1 of 20 methods.*
|
|
576
|
+
* [`PauseJobUnauthorizedUserError`](./src/intuned_client/errors/pausejobunauthorizedusererror.py): Unauthorized. Status code `401`. Applicable to 1 of 20 methods.*
|
|
577
|
+
* [`ResumeJobUnauthorizedUserError`](./src/intuned_client/errors/resumejobunauthorizedusererror.py): Unauthorized. Status code `401`. Applicable to 1 of 20 methods.*
|
|
578
|
+
* [`TriggerJobUnauthorizedUserError`](./src/intuned_client/errors/triggerjobunauthorizedusererror.py): Unauthorized. Status code `401`. Applicable to 1 of 20 methods.*
|
|
579
|
+
* [`GetJobRunsUnauthorizedUserError`](./src/intuned_client/errors/getjobrunsunauthorizedusererror.py): Unauthorized. Status code `401`. Applicable to 1 of 20 methods.*
|
|
580
|
+
* [`GetJobRunUnauthorizedUserError`](./src/intuned_client/errors/getjobrununauthorizedusererror.py): Unauthorized. Status code `401`. Applicable to 1 of 20 methods.*
|
|
581
|
+
* [`TerminateJobRunUnauthorizedUserError`](./src/intuned_client/errors/terminatejobrununauthorizedusererror.py): Unauthorized. Status code `401`. Applicable to 1 of 20 methods.*
|
|
582
|
+
* [`GetJobsNotFoundUserError`](./src/intuned_client/errors/getjobsnotfoundusererror.py): Not Found. Status code `404`. Applicable to 1 of 20 methods.*
|
|
583
|
+
* [`CreateJobNotFoundUserError`](./src/intuned_client/errors/createjobnotfoundusererror.py): Not Found. Status code `404`. Applicable to 1 of 20 methods.*
|
|
584
|
+
* [`GetJobNotFoundUserError`](./src/intuned_client/errors/getjobnotfoundusererror.py): Not Found. Status code `404`. Applicable to 1 of 20 methods.*
|
|
585
|
+
* [`DeleteJobNotFoundUserError`](./src/intuned_client/errors/deletejobnotfoundusererror.py): Not Found. Status code `404`. Applicable to 1 of 20 methods.*
|
|
586
|
+
* [`PauseJobNotFoundUserError`](./src/intuned_client/errors/pausejobnotfoundusererror.py): Not Found. Status code `404`. Applicable to 1 of 20 methods.*
|
|
587
|
+
* [`ResumeJobNotFoundUserError`](./src/intuned_client/errors/resumejobnotfoundusererror.py): Not Found. Status code `404`. Applicable to 1 of 20 methods.*
|
|
588
|
+
* [`TriggerJobNotFoundUserError`](./src/intuned_client/errors/triggerjobnotfoundusererror.py): Not Found. Status code `404`. Applicable to 1 of 20 methods.*
|
|
589
|
+
* [`GetJobRunsNotFoundUserError`](./src/intuned_client/errors/getjobrunsnotfoundusererror.py): Not Found. Status code `404`. Applicable to 1 of 20 methods.*
|
|
590
|
+
* [`GetJobRunNotFoundUserError`](./src/intuned_client/errors/getjobrunnotfoundusererror.py): Not Found. Status code `404`. Applicable to 1 of 20 methods.*
|
|
591
|
+
* [`TerminateJobRunNotFoundUserError`](./src/intuned_client/errors/terminatejobrunnotfoundusererror.py): Not Found. Status code `404`. Applicable to 1 of 20 methods.*
|
|
592
|
+
* [`ResponseValidationError`](./src/intuned_client/errors/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute.
|
|
593
|
+
|
|
594
|
+
</details>
|
|
595
|
+
|
|
596
|
+
\* Check [the method documentation](#available-resources-and-operations) to see if the error is applicable.
|
|
597
|
+
<!-- End Error Handling [errors] -->
|
|
598
|
+
|
|
599
|
+
<!-- Start Server Selection [server] -->
|
|
600
|
+
## Server Selection
|
|
601
|
+
|
|
602
|
+
### Override Server URL Per-Client
|
|
603
|
+
|
|
604
|
+
The default server can be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
|
|
605
|
+
```python
|
|
606
|
+
from intuned_client import IntunedClient
|
|
607
|
+
import os
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
with IntunedClient(
|
|
611
|
+
server_url="https://app.intuned.io/api/v1/workspace",
|
|
612
|
+
workspace_id="123e4567-e89b-12d3-a456-426614174000",
|
|
613
|
+
api_key=os.getenv("INTUNED_API_KEY", ""),
|
|
614
|
+
) as ic_client:
|
|
615
|
+
|
|
616
|
+
res = ic_client.project.run.start(project_name="my-project", parameters={
|
|
617
|
+
"param1": "value1",
|
|
618
|
+
"param2": 42,
|
|
619
|
+
"param3": True,
|
|
620
|
+
}, api="my-awesome-api", proxy="http://username:password@domain:port", save_trace=True, request_timeout=600, retry={}, auth_session={
|
|
621
|
+
"id": "auth-session-123",
|
|
622
|
+
"auto_recreate": True,
|
|
623
|
+
"check_attempts": 3,
|
|
624
|
+
"create_attempts": 3,
|
|
625
|
+
"proxy": "http://username:password@domain:port",
|
|
626
|
+
"request_timeout": 600,
|
|
627
|
+
}, sink={
|
|
628
|
+
"type": "webhook",
|
|
629
|
+
"url": "https://example.com/webhook",
|
|
630
|
+
"headers": {
|
|
631
|
+
"Content-Type": "application/json",
|
|
632
|
+
"Authorization": "Bearer token",
|
|
633
|
+
},
|
|
634
|
+
"skip_on_fail": False,
|
|
635
|
+
"apis_to_send": [
|
|
636
|
+
"api1",
|
|
637
|
+
"api2",
|
|
638
|
+
],
|
|
639
|
+
})
|
|
640
|
+
|
|
641
|
+
# Handle response
|
|
642
|
+
print(res)
|
|
643
|
+
|
|
644
|
+
```
|
|
645
|
+
<!-- End Server Selection [server] -->
|
|
646
|
+
|
|
647
|
+
<!-- Start Custom HTTP Client [http-client] -->
|
|
648
|
+
## Custom HTTP Client
|
|
649
|
+
|
|
650
|
+
The Python SDK makes API calls using the [httpx](https://www.python-httpx.org/) HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with your own HTTP client instance.
|
|
651
|
+
Depending on whether you are using the sync or async version of the SDK, you can pass an instance of `HttpClient` or `AsyncHttpClient` respectively, which are Protocol's ensuring that the client has the necessary methods to make API calls.
|
|
652
|
+
This allows you to wrap the client with your own custom logic, such as adding custom headers, logging, or error handling, or you can just pass an instance of `httpx.Client` or `httpx.AsyncClient` directly.
|
|
653
|
+
|
|
654
|
+
For example, you could specify a header for every request that this sdk makes as follows:
|
|
655
|
+
```python
|
|
656
|
+
from intuned_client import IntunedClient
|
|
657
|
+
import httpx
|
|
658
|
+
|
|
659
|
+
http_client = httpx.Client(headers={"x-custom-header": "someValue"})
|
|
660
|
+
s = IntunedClient(client=http_client)
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
or you could wrap the client with your own custom logic:
|
|
664
|
+
```python
|
|
665
|
+
from intuned_client import IntunedClient
|
|
666
|
+
from intuned_client.httpclient import AsyncHttpClient
|
|
667
|
+
import httpx
|
|
668
|
+
|
|
669
|
+
class CustomClient(AsyncHttpClient):
|
|
670
|
+
client: AsyncHttpClient
|
|
671
|
+
|
|
672
|
+
def __init__(self, client: AsyncHttpClient):
|
|
673
|
+
self.client = client
|
|
674
|
+
|
|
675
|
+
async def send(
|
|
676
|
+
self,
|
|
677
|
+
request: httpx.Request,
|
|
678
|
+
*,
|
|
679
|
+
stream: bool = False,
|
|
680
|
+
auth: Union[
|
|
681
|
+
httpx._types.AuthTypes, httpx._client.UseClientDefault, None
|
|
682
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
683
|
+
follow_redirects: Union[
|
|
684
|
+
bool, httpx._client.UseClientDefault
|
|
685
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
686
|
+
) -> httpx.Response:
|
|
687
|
+
request.headers["Client-Level-Header"] = "added by client"
|
|
688
|
+
|
|
689
|
+
return await self.client.send(
|
|
690
|
+
request, stream=stream, auth=auth, follow_redirects=follow_redirects
|
|
691
|
+
)
|
|
692
|
+
|
|
693
|
+
def build_request(
|
|
694
|
+
self,
|
|
695
|
+
method: str,
|
|
696
|
+
url: httpx._types.URLTypes,
|
|
697
|
+
*,
|
|
698
|
+
content: Optional[httpx._types.RequestContent] = None,
|
|
699
|
+
data: Optional[httpx._types.RequestData] = None,
|
|
700
|
+
files: Optional[httpx._types.RequestFiles] = None,
|
|
701
|
+
json: Optional[Any] = None,
|
|
702
|
+
params: Optional[httpx._types.QueryParamTypes] = None,
|
|
703
|
+
headers: Optional[httpx._types.HeaderTypes] = None,
|
|
704
|
+
cookies: Optional[httpx._types.CookieTypes] = None,
|
|
705
|
+
timeout: Union[
|
|
706
|
+
httpx._types.TimeoutTypes, httpx._client.UseClientDefault
|
|
707
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
708
|
+
extensions: Optional[httpx._types.RequestExtensions] = None,
|
|
709
|
+
) -> httpx.Request:
|
|
710
|
+
return self.client.build_request(
|
|
711
|
+
method,
|
|
712
|
+
url,
|
|
713
|
+
content=content,
|
|
714
|
+
data=data,
|
|
715
|
+
files=files,
|
|
716
|
+
json=json,
|
|
717
|
+
params=params,
|
|
718
|
+
headers=headers,
|
|
719
|
+
cookies=cookies,
|
|
720
|
+
timeout=timeout,
|
|
721
|
+
extensions=extensions,
|
|
722
|
+
)
|
|
723
|
+
|
|
724
|
+
s = IntunedClient(async_client=CustomClient(httpx.AsyncClient()))
|
|
725
|
+
```
|
|
726
|
+
<!-- End Custom HTTP Client [http-client] -->
|
|
727
|
+
|
|
728
|
+
<!-- Start Resource Management [resource-management] -->
|
|
729
|
+
## Resource Management
|
|
730
|
+
|
|
731
|
+
The `IntunedClient` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.
|
|
732
|
+
|
|
733
|
+
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
|
|
734
|
+
|
|
735
|
+
```python
|
|
736
|
+
from intuned_client import IntunedClient
|
|
737
|
+
import os
|
|
738
|
+
def main():
|
|
739
|
+
|
|
740
|
+
with IntunedClient(
|
|
741
|
+
workspace_id="123e4567-e89b-12d3-a456-426614174000",
|
|
742
|
+
api_key=os.getenv("INTUNED_API_KEY", ""),
|
|
743
|
+
) as ic_client:
|
|
744
|
+
# Rest of application here...
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
# Or when using async:
|
|
748
|
+
async def amain():
|
|
749
|
+
|
|
750
|
+
async with IntunedClient(
|
|
751
|
+
workspace_id="123e4567-e89b-12d3-a456-426614174000",
|
|
752
|
+
api_key=os.getenv("INTUNED_API_KEY", ""),
|
|
753
|
+
) as ic_client:
|
|
754
|
+
# Rest of application here...
|
|
755
|
+
```
|
|
756
|
+
<!-- End Resource Management [resource-management] -->
|
|
757
|
+
|
|
758
|
+
<!-- Start Debugging [debug] -->
|
|
759
|
+
## Debugging
|
|
760
|
+
|
|
761
|
+
You can setup your SDK to emit debug logs for SDK requests and responses.
|
|
762
|
+
|
|
763
|
+
You can pass your own logger class directly into your SDK.
|
|
764
|
+
```python
|
|
765
|
+
from intuned_client import IntunedClient
|
|
766
|
+
import logging
|
|
767
|
+
|
|
768
|
+
logging.basicConfig(level=logging.DEBUG)
|
|
769
|
+
s = IntunedClient(debug_logger=logging.getLogger("intuned_client"))
|
|
770
|
+
```
|
|
771
|
+
|
|
772
|
+
You can also enable a default debug logger by setting an environment variable `INTUNED_DEBUG` to true.
|
|
773
|
+
<!-- End Debugging [debug] -->
|
|
774
|
+
|
|
775
|
+
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
|
776
|
+
|
|
777
|
+
# Development
|
|
778
|
+
|
|
779
|
+
## Maturity
|
|
780
|
+
|
|
781
|
+
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
|
|
782
|
+
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
|
|
783
|
+
looking for the latest version.
|
|
784
|
+
|
|
785
|
+
## Contributions
|
|
786
|
+
|
|
787
|
+
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
|
|
788
|
+
We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
|
|
789
|
+
|
|
790
|
+
### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=intuned-client&utm_campaign=python)
|
|
791
|
+
|
|
792
|
+
<style>
|
|
793
|
+
:root {
|
|
794
|
+
--badge-gray-bg: #f3f4f6;
|
|
795
|
+
--badge-gray-border: #d1d5db;
|
|
796
|
+
--badge-gray-text: #374151;
|
|
797
|
+
--badge-blue-bg: #eff6ff;
|
|
798
|
+
--badge-blue-border: #3b82f6;
|
|
799
|
+
--badge-blue-text: #3b82f6;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
@media (prefers-color-scheme: dark) {
|
|
803
|
+
:root {
|
|
804
|
+
--badge-gray-bg: #374151;
|
|
805
|
+
--badge-gray-border: #4b5563;
|
|
806
|
+
--badge-gray-text: #f3f4f6;
|
|
807
|
+
--badge-blue-bg: #1e3a8a;
|
|
808
|
+
--badge-blue-border: #3b82f6;
|
|
809
|
+
--badge-blue-text: #93c5fd;
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
h1 {
|
|
814
|
+
border-bottom: none !important;
|
|
815
|
+
margin-bottom: 4px;
|
|
816
|
+
margin-top: 0;
|
|
817
|
+
letter-spacing: 0.5px;
|
|
818
|
+
font-weight: 600;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
.badge-text {
|
|
822
|
+
letter-spacing: 1px;
|
|
823
|
+
font-weight: 300;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
.badge-container {
|
|
827
|
+
display: inline-flex;
|
|
828
|
+
align-items: center;
|
|
829
|
+
background: var(--badge-gray-bg);
|
|
830
|
+
border: 1px solid var(--badge-gray-border);
|
|
831
|
+
border-radius: 6px;
|
|
832
|
+
overflow: hidden;
|
|
833
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
|
|
834
|
+
font-size: 11px;
|
|
835
|
+
text-decoration: none;
|
|
836
|
+
vertical-align: middle;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
.badge-container.blue {
|
|
840
|
+
background: var(--badge-blue-bg);
|
|
841
|
+
border-color: var(--badge-blue-border);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
.badge-icon-section {
|
|
845
|
+
padding: 4px 8px;
|
|
846
|
+
border-right: 1px solid var(--badge-gray-border);
|
|
847
|
+
display: flex;
|
|
848
|
+
align-items: center;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
.badge-text-section {
|
|
852
|
+
padding: 4px 10px;
|
|
853
|
+
color: var(--badge-gray-text);
|
|
854
|
+
font-weight: 400;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
.badge-container.blue .badge-text-section {
|
|
858
|
+
color: var(--badge-blue-text);
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
.badge-link {
|
|
862
|
+
text-decoration: none;
|
|
863
|
+
margin-left: 8px;
|
|
864
|
+
display: inline-flex;
|
|
865
|
+
vertical-align: middle;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
.badge-link:hover {
|
|
869
|
+
text-decoration: none;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
.badge-link:first-child {
|
|
873
|
+
margin-left: 0;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
.badge-icon-section svg {
|
|
877
|
+
color: var(--badge-gray-text);
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
.badge-container.blue .badge-icon-section svg {
|
|
881
|
+
color: var(--badge-blue-text);
|
|
882
|
+
}
|
|
883
|
+
</style>
|