albus-sdk 0.1.0__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.
Files changed (93) hide show
  1. albus_sdk-0.1.0/LICENSE +21 -0
  2. albus_sdk-0.1.0/PKG-INFO +673 -0
  3. albus_sdk-0.1.0/README-PYPI.md +655 -0
  4. albus_sdk-0.1.0/README.md +655 -0
  5. albus_sdk-0.1.0/pyproject.toml +60 -0
  6. albus_sdk-0.1.0/setup.cfg +4 -0
  7. albus_sdk-0.1.0/src/albus_sdk/__init__.py +17 -0
  8. albus_sdk-0.1.0/src/albus_sdk/_hooks/__init__.py +4 -0
  9. albus_sdk-0.1.0/src/albus_sdk/_hooks/sdkhooks.py +74 -0
  10. albus_sdk-0.1.0/src/albus_sdk/_hooks/types.py +124 -0
  11. albus_sdk-0.1.0/src/albus_sdk/_version.py +15 -0
  12. albus_sdk-0.1.0/src/albus_sdk/auth.py +197 -0
  13. albus_sdk-0.1.0/src/albus_sdk/basesdk.py +392 -0
  14. albus_sdk-0.1.0/src/albus_sdk/errors/__init__.py +74 -0
  15. albus_sdk-0.1.0/src/albus_sdk/errors/albusdefaulterror.py +40 -0
  16. albus_sdk-0.1.0/src/albus_sdk/errors/albuserror.py +30 -0
  17. albus_sdk-0.1.0/src/albus_sdk/errors/errbadrequest.py +29 -0
  18. albus_sdk-0.1.0/src/albus_sdk/errors/errconflict.py +29 -0
  19. albus_sdk-0.1.0/src/albus_sdk/errors/errlocked.py +29 -0
  20. albus_sdk-0.1.0/src/albus_sdk/errors/errnotfound.py +29 -0
  21. albus_sdk-0.1.0/src/albus_sdk/errors/errrunfailed.py +33 -0
  22. albus_sdk-0.1.0/src/albus_sdk/errors/errtimeout.py +29 -0
  23. albus_sdk-0.1.0/src/albus_sdk/errors/errunauthorized.py +29 -0
  24. albus_sdk-0.1.0/src/albus_sdk/errors/healthresponse_error.py +27 -0
  25. albus_sdk-0.1.0/src/albus_sdk/errors/no_response_error.py +17 -0
  26. albus_sdk-0.1.0/src/albus_sdk/errors/responsevalidationerror.py +27 -0
  27. albus_sdk-0.1.0/src/albus_sdk/health.py +184 -0
  28. albus_sdk-0.1.0/src/albus_sdk/httpclient.py +125 -0
  29. albus_sdk-0.1.0/src/albus_sdk/models/__init__.py +200 -0
  30. albus_sdk-0.1.0/src/albus_sdk/models/auditevent.py +64 -0
  31. albus_sdk-0.1.0/src/albus_sdk/models/createsecretrequest.py +18 -0
  32. albus_sdk-0.1.0/src/albus_sdk/models/createtokenrequest.py +13 -0
  33. albus_sdk-0.1.0/src/albus_sdk/models/createtokenresponse.py +35 -0
  34. albus_sdk-0.1.0/src/albus_sdk/models/deletesecretop.py +16 -0
  35. albus_sdk-0.1.0/src/albus_sdk/models/deletesessionop.py +18 -0
  36. albus_sdk-0.1.0/src/albus_sdk/models/deletetokenop.py +18 -0
  37. albus_sdk-0.1.0/src/albus_sdk/models/getsecretop.py +16 -0
  38. albus_sdk-0.1.0/src/albus_sdk/models/getsessionauditop.py +56 -0
  39. albus_sdk-0.1.0/src/albus_sdk/models/getsessionop.py +56 -0
  40. albus_sdk-0.1.0/src/albus_sdk/models/gettokenop.py +18 -0
  41. albus_sdk-0.1.0/src/albus_sdk/models/healthresponse.py +13 -0
  42. albus_sdk-0.1.0/src/albus_sdk/models/listauditeventsresponse.py +41 -0
  43. albus_sdk-0.1.0/src/albus_sdk/models/listsecretsresponse.py +15 -0
  44. albus_sdk-0.1.0/src/albus_sdk/models/listsessionsresponse.py +15 -0
  45. albus_sdk-0.1.0/src/albus_sdk/models/listtokensresponse.py +15 -0
  46. albus_sdk-0.1.0/src/albus_sdk/models/mcpserver.py +60 -0
  47. albus_sdk-0.1.0/src/albus_sdk/models/model.py +37 -0
  48. albus_sdk-0.1.0/src/albus_sdk/models/provider.py +47 -0
  49. albus_sdk-0.1.0/src/albus_sdk/models/runsessionop.py +99 -0
  50. albus_sdk-0.1.0/src/albus_sdk/models/runsessionrequest.py +58 -0
  51. albus_sdk-0.1.0/src/albus_sdk/models/secret.py +18 -0
  52. albus_sdk-0.1.0/src/albus_sdk/models/security.py +55 -0
  53. albus_sdk-0.1.0/src/albus_sdk/models/session.py +66 -0
  54. albus_sdk-0.1.0/src/albus_sdk/models/sessionmessage.py +40 -0
  55. albus_sdk-0.1.0/src/albus_sdk/models/sessionresponse.py +19 -0
  56. albus_sdk-0.1.0/src/albus_sdk/models/token.py +51 -0
  57. albus_sdk-0.1.0/src/albus_sdk/models/updatesecretop.py +23 -0
  58. albus_sdk-0.1.0/src/albus_sdk/models/updatesecretrequest.py +15 -0
  59. albus_sdk-0.1.0/src/albus_sdk/models/whoamiresponse.py +58 -0
  60. albus_sdk-0.1.0/src/albus_sdk/py.typed +1 -0
  61. albus_sdk-0.1.0/src/albus_sdk/sdk.py +188 -0
  62. albus_sdk-0.1.0/src/albus_sdk/sdkconfiguration.py +51 -0
  63. albus_sdk-0.1.0/src/albus_sdk/secrets.py +1027 -0
  64. albus_sdk-0.1.0/src/albus_sdk/sessions.py +1163 -0
  65. albus_sdk-0.1.0/src/albus_sdk/tokens.py +793 -0
  66. albus_sdk-0.1.0/src/albus_sdk/types/__init__.py +24 -0
  67. albus_sdk-0.1.0/src/albus_sdk/types/base64fileinput.py +43 -0
  68. albus_sdk-0.1.0/src/albus_sdk/types/basemodel.py +77 -0
  69. albus_sdk-0.1.0/src/albus_sdk/utils/__init__.py +180 -0
  70. albus_sdk-0.1.0/src/albus_sdk/utils/annotations.py +79 -0
  71. albus_sdk-0.1.0/src/albus_sdk/utils/datetimes.py +37 -0
  72. albus_sdk-0.1.0/src/albus_sdk/utils/dynamic_imports.py +54 -0
  73. albus_sdk-0.1.0/src/albus_sdk/utils/enums.py +134 -0
  74. albus_sdk-0.1.0/src/albus_sdk/utils/eventstreaming.py +326 -0
  75. albus_sdk-0.1.0/src/albus_sdk/utils/forms.py +239 -0
  76. albus_sdk-0.1.0/src/albus_sdk/utils/headers.py +136 -0
  77. albus_sdk-0.1.0/src/albus_sdk/utils/logger.py +27 -0
  78. albus_sdk-0.1.0/src/albus_sdk/utils/metadata.py +119 -0
  79. albus_sdk-0.1.0/src/albus_sdk/utils/queryparams.py +217 -0
  80. albus_sdk-0.1.0/src/albus_sdk/utils/requestbodies.py +67 -0
  81. albus_sdk-0.1.0/src/albus_sdk/utils/retries.py +356 -0
  82. albus_sdk-0.1.0/src/albus_sdk/utils/security.py +218 -0
  83. albus_sdk-0.1.0/src/albus_sdk/utils/serializers.py +306 -0
  84. albus_sdk-0.1.0/src/albus_sdk/utils/unmarshal_json_response.py +38 -0
  85. albus_sdk-0.1.0/src/albus_sdk/utils/url.py +155 -0
  86. albus_sdk-0.1.0/src/albus_sdk/utils/values.py +137 -0
  87. albus_sdk-0.1.0/src/albus_sdk.egg-info/PKG-INFO +673 -0
  88. albus_sdk-0.1.0/src/albus_sdk.egg-info/SOURCES.txt +91 -0
  89. albus_sdk-0.1.0/src/albus_sdk.egg-info/dependency_links.txt +1 -0
  90. albus_sdk-0.1.0/src/albus_sdk.egg-info/requires.txt +3 -0
  91. albus_sdk-0.1.0/src/albus_sdk.egg-info/top_level.txt +1 -0
  92. albus_sdk-0.1.0/tests/test_release_metadata.py +74 -0
  93. albus_sdk-0.1.0/tests/test_smoke.py +119 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Albus
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,673 @@
1
+ Metadata-Version: 2.4
2
+ Name: albus-sdk
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the Albus API.
5
+ Author: Albus
6
+ License-Expression: MIT
7
+ Project-URL: homepage, https://albus.sh
8
+ Project-URL: repository, https://github.com/albusgroup/albus-python
9
+ Project-URL: documentation, https://github.com/albusgroup/albus-python#readme
10
+ Project-URL: issues, https://github.com/albusgroup/albus-python/issues
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: httpcore>=1.0.9
15
+ Requires-Dist: httpx>=0.28.1
16
+ Requires-Dist: pydantic<2.13,>=2.11.2
17
+ Dynamic: license-file
18
+
19
+ # albus-sdk
20
+
21
+ Official, type-safe Python SDK for the Albus API.
22
+
23
+ [![Built by Speakeasy](https://img.shields.io/badge/Built_by-SPEAKEASY-374151?style=for-the-badge&labelColor=f3f4f6)](https://www.speakeasy.com/?utm_source=albus-sdk&utm_campaign=python)
24
+ [![License: MIT](https://img.shields.io/badge/LICENSE_//_MIT-3b5bdb?style=for-the-badge&labelColor=eff6ff)](https://opensource.org/licenses/MIT)
25
+
26
+ ## Quickstart
27
+
28
+ Install the SDK from PyPI:
29
+
30
+ ```bash
31
+ pip install albus-sdk
32
+ ```
33
+
34
+ Session operations use an organization API key:
35
+
36
+ ```python
37
+ import os
38
+
39
+ from albus_sdk import Albus, models
40
+
41
+
42
+ with Albus(
43
+ security=models.Security(
44
+ api_key_auth=os.environ["ALBUS_API_KEY_AUTH"],
45
+ ),
46
+ ) as albus:
47
+ response = albus.sessions.list_sessions()
48
+ print(response.sessions)
49
+ ```
50
+
51
+ User and token operations use a user bearer token. Every synchronous operation
52
+ also has an asynchronous method with an `_async` suffix:
53
+
54
+ ```python
55
+ import asyncio
56
+ import os
57
+
58
+ from albus_sdk import Albus, models
59
+
60
+
61
+ async def main() -> None:
62
+ async with Albus(
63
+ security=models.Security(
64
+ bearer_auth=os.environ["ALBUS_BEARER_AUTH"],
65
+ ),
66
+ ) as albus:
67
+ response = await albus.auth.whoami_async()
68
+ print(response)
69
+
70
+
71
+ asyncio.run(main())
72
+ ```
73
+
74
+ Secret operations accept either credential. The SDK also reads
75
+ `ALBUS_API_KEY_AUTH` and `ALBUS_BEARER_AUTH` directly from the environment, so
76
+ `Albus()` is sufficient when the appropriate variable is set. Production
77
+ requests use `https://albus.sh/api` by default.
78
+
79
+ <!-- Start Summary [summary] -->
80
+ ## Summary
81
+
82
+ Albus API: Albus service REST API
83
+ <!-- End Summary [summary] -->
84
+
85
+ <!-- Start Table of Contents [toc] -->
86
+ ## Table of Contents
87
+ <!-- $toc-max-depth=2 -->
88
+ * [albus-sdk](#albus-sdk)
89
+ * [Quickstart](#quickstart)
90
+ * [SDK Installation](#sdk-installation)
91
+ * [IDE Support](#ide-support)
92
+ * [SDK Example Usage](#sdk-example-usage)
93
+ * [Authentication](#authentication)
94
+ * [Available Resources and Operations](#available-resources-and-operations)
95
+ * [Retries](#retries)
96
+ * [Error Handling](#error-handling)
97
+ * [Server Selection](#server-selection)
98
+ * [Custom HTTP Client](#custom-http-client)
99
+ * [Resource Management](#resource-management)
100
+ * [Debugging](#debugging)
101
+ * [Development](#development)
102
+ * [Regeneration](#regeneration)
103
+ * [Checks](#checks)
104
+ * [Releases](#releases)
105
+ * [Maturity](#maturity)
106
+ * [Contributions](#contributions)
107
+
108
+ <!-- End Table of Contents [toc] -->
109
+
110
+ <!-- Start SDK Installation [installation] -->
111
+ ## SDK Installation
112
+
113
+ > [!NOTE]
114
+ > **Python version upgrade policy**
115
+ >
116
+ > 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.
117
+
118
+ The SDK can be installed with *uv*, *pip*, or *poetry* package managers.
119
+
120
+ ### uv
121
+
122
+ *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.
123
+
124
+ ```bash
125
+ uv add albus-sdk
126
+ ```
127
+
128
+ ### PIP
129
+
130
+ *PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.
131
+
132
+ ```bash
133
+ pip install albus-sdk
134
+ ```
135
+
136
+ ### Poetry
137
+
138
+ *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.
139
+
140
+ ```bash
141
+ poetry add albus-sdk
142
+ ```
143
+
144
+ ### Shell and script usage with `uv`
145
+
146
+ 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:
147
+
148
+ ```shell
149
+ uvx --from albus-sdk python
150
+ ```
151
+
152
+ It's also possible to write a standalone Python script without needing to set up a whole project like so:
153
+
154
+ ```python
155
+ #!/usr/bin/env -S uv run --script
156
+ # /// script
157
+ # requires-python = ">=3.10"
158
+ # dependencies = [
159
+ # "albus-sdk",
160
+ # ]
161
+ # ///
162
+
163
+ from albus_sdk import Albus
164
+
165
+ sdk = Albus(
166
+ # SDK arguments
167
+ )
168
+
169
+ # Rest of script here...
170
+ ```
171
+
172
+ Once that is saved to a file, you can run it with `uv run script.py` where
173
+ `script.py` can be replaced with the actual file name.
174
+ <!-- End SDK Installation [installation] -->
175
+
176
+ <!-- Start IDE Support [idesupport] -->
177
+ ## IDE Support
178
+
179
+ ### PyCharm
180
+
181
+ 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.
182
+
183
+ - [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/)
184
+ <!-- End IDE Support [idesupport] -->
185
+
186
+ <!-- Start SDK Example Usage [usage] -->
187
+ ## SDK Example Usage
188
+
189
+ ### Example
190
+
191
+ ```python
192
+ # Synchronous Example
193
+ from albus_sdk import Albus, models
194
+ import os
195
+
196
+
197
+ with Albus(
198
+ security=models.Security(
199
+ bearer_auth=os.getenv("ALBUS_BEARER_AUTH", ""),
200
+ ),
201
+ ) as albus:
202
+
203
+ res = albus.secrets.list_secrets()
204
+
205
+ # Handle response
206
+ print(res)
207
+ ```
208
+
209
+ </br>
210
+
211
+ The same SDK client can also be used to make asynchronous requests by importing asyncio.
212
+
213
+ ```python
214
+ # Asynchronous Example
215
+ from albus_sdk import Albus, models
216
+ import asyncio
217
+ import os
218
+
219
+ async def main():
220
+
221
+ async with Albus(
222
+ security=models.Security(
223
+ bearer_auth=os.getenv("ALBUS_BEARER_AUTH", ""),
224
+ ),
225
+ ) as albus:
226
+
227
+ res = await albus.secrets.list_secrets_async()
228
+
229
+ # Handle response
230
+ print(res)
231
+
232
+ asyncio.run(main())
233
+ ```
234
+ <!-- End SDK Example Usage [usage] -->
235
+
236
+ <!-- Start Authentication [security] -->
237
+ ## Authentication
238
+
239
+ ### Per-Client Security Schemes
240
+
241
+ This SDK supports the following security schemes globally:
242
+
243
+ | Name | Type | Scheme | Environment Variable |
244
+ | -------------- | ---- | ----------- | -------------------- |
245
+ | `bearer_auth` | http | HTTP Bearer | `ALBUS_BEARER_AUTH` |
246
+ | `api_key_auth` | http | HTTP Bearer | `ALBUS_API_KEY_AUTH` |
247
+
248
+ You can set the security parameters through the `security` optional parameter when initializing the SDK client instance. The selected scheme will be used by default to authenticate with the API for all operations that support it. For example:
249
+ ```python
250
+ from albus_sdk import Albus, models
251
+ import os
252
+
253
+
254
+ with Albus(
255
+ security=models.Security(
256
+ bearer_auth=os.getenv("ALBUS_BEARER_AUTH", ""),
257
+ ),
258
+ ) as albus:
259
+
260
+ res = albus.secrets.list_secrets()
261
+
262
+ # Handle response
263
+ print(res)
264
+
265
+ ```
266
+ <!-- End Authentication [security] -->
267
+
268
+ <!-- Start Available Resources and Operations [operations] -->
269
+ ## Available Resources and Operations
270
+
271
+ <details open>
272
+ <summary>Available methods</summary>
273
+
274
+ ### [Auth](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/auth/README.md)
275
+
276
+ * [whoami](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/auth/README.md#whoami) - Get current user information
277
+
278
+ ### [Health](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/health/README.md)
279
+
280
+ * [health](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/health/README.md#health) - Health check endpoint
281
+
282
+ ### [Secrets](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/secrets/README.md)
283
+
284
+ * [list_secrets](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/secrets/README.md#list_secrets) - List all secrets
285
+ * [create_secret](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/secrets/README.md#create_secret) - Create a secret
286
+ * [get_secret](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/secrets/README.md#get_secret) - Get a secret by name
287
+ * [update_secret](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/secrets/README.md#update_secret) - Update a secret by name
288
+ * [delete_secret](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/secrets/README.md#delete_secret) - Delete a secret by name
289
+
290
+ ### [Sessions](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/sessions/README.md)
291
+
292
+ * [list_sessions](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/sessions/README.md#list_sessions) - List all sessions
293
+ * [get_session](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/sessions/README.md#get_session) - Get a session with its messages
294
+ * [run_session](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/sessions/README.md#run_session) - Run or resume a session
295
+ * [delete_session](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/sessions/README.md#delete_session) - Delete a session
296
+ * [get_session_audit](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/sessions/README.md#get_session_audit) - List a session's audit log
297
+
298
+ ### [Tokens](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/tokens/README.md)
299
+
300
+ * [list_tokens](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/tokens/README.md#list_tokens) - List all API tokens. Never returns token values, only metadata.
301
+ * [create_token](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/tokens/README.md#create_token) - Create an API token. The token value is returned only in this response.
302
+ * [get_token](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/tokens/README.md#get_token) - Get token metadata by ID. Never returns the token value.
303
+ * [delete_token](https://github.com/albusgroup/albus-python/blob/master/docs/sdks/tokens/README.md#delete_token) - Revoke an API token by ID
304
+
305
+ </details>
306
+ <!-- End Available Resources and Operations [operations] -->
307
+
308
+ <!-- Start Retries [retries] -->
309
+ ## Retries
310
+
311
+ 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.
312
+
313
+ To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
314
+ ```python
315
+ from albus_sdk import Albus, models
316
+ from albus_sdk.utils import BackoffStrategy, RetryConfig
317
+ import os
318
+
319
+
320
+ with Albus(
321
+ security=models.Security(
322
+ bearer_auth=os.getenv("ALBUS_BEARER_AUTH", ""),
323
+ ),
324
+ ) as albus:
325
+
326
+ res = albus.secrets.list_secrets(
327
+ retries=RetryConfig(
328
+ "backoff",
329
+ BackoffStrategy(1, 50, 1.1, 100),
330
+ False,
331
+ )
332
+ )
333
+
334
+ # Handle response
335
+ print(res)
336
+
337
+ ```
338
+
339
+ 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:
340
+ ```python
341
+ from albus_sdk import Albus, models
342
+ from albus_sdk.utils import BackoffStrategy, RetryConfig
343
+ import os
344
+
345
+
346
+ with Albus(
347
+ retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
348
+ security=models.Security(
349
+ bearer_auth=os.getenv("ALBUS_BEARER_AUTH", ""),
350
+ ),
351
+ ) as albus:
352
+
353
+ res = albus.secrets.list_secrets()
354
+
355
+ # Handle response
356
+ print(res)
357
+
358
+ ```
359
+ <!-- End Retries [retries] -->
360
+
361
+ <!-- Start Error Handling [errors] -->
362
+ ## Error Handling
363
+
364
+ [`AlbusError`](https://github.com/albusgroup/albus-python/blob/master/./src/albus_sdk/errors/albuserror.py) is the base class for all HTTP error responses. It has the following properties:
365
+
366
+ | Property | Type | Description |
367
+ | ------------------ | ---------------- | --------------------------------------------------------------------------------------- |
368
+ | `err.message` | `str` | Error message |
369
+ | `err.status_code` | `int` | HTTP response status code eg `404` |
370
+ | `err.headers` | `httpx.Headers` | HTTP response headers |
371
+ | `err.body` | `str` | HTTP body. Can be empty string if no body is returned. |
372
+ | `err.raw_response` | `httpx.Response` | Raw HTTP response |
373
+ | `err.data` | | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). |
374
+
375
+ ### Example
376
+ ```python
377
+ from albus_sdk import Albus, errors, models
378
+ import os
379
+
380
+
381
+ with Albus(
382
+ security=models.Security(
383
+ bearer_auth=os.getenv("ALBUS_BEARER_AUTH", ""),
384
+ ),
385
+ ) as albus:
386
+ res = None
387
+ try:
388
+
389
+ res = albus.secrets.list_secrets()
390
+
391
+ # Handle response
392
+ print(res)
393
+
394
+
395
+ except errors.AlbusError as e:
396
+ # The base class for HTTP error responses
397
+ print(e.message)
398
+ print(e.status_code)
399
+ print(e.body)
400
+ print(e.headers)
401
+ print(e.raw_response)
402
+
403
+ # Depending on the method different errors may be thrown
404
+ if isinstance(e, errors.ErrUnauthorized):
405
+ print(e.data.message) # str
406
+ ```
407
+
408
+ ### Error Classes
409
+ **Primary errors:**
410
+ * [`AlbusError`](https://github.com/albusgroup/albus-python/blob/master/./src/albus_sdk/errors/albuserror.py): The base class for HTTP error responses.
411
+ * [`ErrUnauthorized`](https://github.com/albusgroup/albus-python/blob/master/./src/albus_sdk/errors/errunauthorized.py): Status code `401`. *
412
+
413
+ <details><summary>Less common errors (12)</summary>
414
+
415
+ <br />
416
+
417
+ **Network errors:**
418
+ * [`httpx.RequestError`](https://www.python-httpx.org/exceptions/#httpx.RequestError): Base class for request errors.
419
+ * [`httpx.ConnectError`](https://www.python-httpx.org/exceptions/#httpx.ConnectError): HTTP client was unable to make a request to a server.
420
+ * [`httpx.TimeoutException`](https://www.python-httpx.org/exceptions/#httpx.TimeoutException): HTTP request timed out.
421
+
422
+
423
+ **Inherit from [`AlbusError`](https://github.com/albusgroup/albus-python/blob/master/./src/albus_sdk/errors/albuserror.py)**:
424
+ * [`ErrNotFound`](https://github.com/albusgroup/albus-python/blob/master/./src/albus_sdk/errors/errnotfound.py): Not found. Status code `404`. Applicable to 8 of 16 methods.*
425
+ * [`ErrBadRequest`](https://github.com/albusgroup/albus-python/blob/master/./src/albus_sdk/errors/errbadrequest.py): Status code `400`. Applicable to 5 of 16 methods.*
426
+ * [`ErrConflict`](https://github.com/albusgroup/albus-python/blob/master/./src/albus_sdk/errors/errconflict.py): Idempotency key reused with a different request body. Status code `409`. Applicable to 1 of 16 methods.*
427
+ * [`ErrLocked`](https://github.com/albusgroup/albus-python/blob/master/./src/albus_sdk/errors/errlocked.py): Another invocation is currently running for this session. Status code `423`. Applicable to 1 of 16 methods.*
428
+ * [`ErrRunFailed`](https://github.com/albusgroup/albus-python/blob/master/./src/albus_sdk/errors/errrunfailed.py): The harness run failed instead of producing a response (only possible with wait=true, or when replaying a failed invocation). The body carries the failure kind and detail. Status code `502`. Applicable to 1 of 16 methods.*
429
+ * [`HealthResponseError`](https://github.com/albusgroup/albus-python/blob/master/./src/albus_sdk/errors/healthresponseerror.py): Service is healthy. Status code `503`. Applicable to 1 of 16 methods.*
430
+ * [`ErrTimeout`](https://github.com/albusgroup/albus-python/blob/master/./src/albus_sdk/errors/errtimeout.py): Timed out waiting for the assistant response. Status code `504`. Applicable to 1 of 16 methods.*
431
+ * [`ResponseValidationError`](https://github.com/albusgroup/albus-python/blob/master/./src/albus_sdk/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.
432
+
433
+ </details>
434
+
435
+ \* Check [the method documentation](#available-resources-and-operations) to see if the error is applicable.
436
+ <!-- End Error Handling [errors] -->
437
+
438
+ <!-- Start Server Selection [server] -->
439
+ ## Server Selection
440
+
441
+ ### Select Server by Index
442
+
443
+ You can override the default server globally by passing a server index to the `server_idx: int` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
444
+
445
+ | # | Server | Description |
446
+ | --- | ----------------------- | ------------------------ |
447
+ | 0 | `https://albus.sh/api` | Production server |
448
+ | 1 | `http://localhost:8080` | Local development server |
449
+
450
+ #### Example
451
+
452
+ ```python
453
+ from albus_sdk import Albus, models
454
+ import os
455
+
456
+
457
+ with Albus(
458
+ server_idx=0,
459
+ security=models.Security(
460
+ bearer_auth=os.getenv("ALBUS_BEARER_AUTH", ""),
461
+ ),
462
+ ) as albus:
463
+
464
+ res = albus.secrets.list_secrets()
465
+
466
+ # Handle response
467
+ print(res)
468
+
469
+ ```
470
+
471
+ ### Override Server URL Per-Client
472
+
473
+ The default server can also be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
474
+ ```python
475
+ from albus_sdk import Albus, models
476
+ import os
477
+
478
+
479
+ with Albus(
480
+ server_url="http://localhost:8080",
481
+ security=models.Security(
482
+ bearer_auth=os.getenv("ALBUS_BEARER_AUTH", ""),
483
+ ),
484
+ ) as albus:
485
+
486
+ res = albus.secrets.list_secrets()
487
+
488
+ # Handle response
489
+ print(res)
490
+
491
+ ```
492
+ <!-- End Server Selection [server] -->
493
+
494
+ <!-- Start Custom HTTP Client [http-client] -->
495
+ ## Custom HTTP Client
496
+
497
+ 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.
498
+ 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.
499
+ 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.
500
+
501
+ For example, you could specify a header for every request that this sdk makes as follows:
502
+ ```python
503
+ from albus_sdk import Albus
504
+ import httpx
505
+
506
+ http_client = httpx.Client(headers={"x-custom-header": "someValue"})
507
+ s = Albus(client=http_client)
508
+ ```
509
+
510
+ or you could wrap the client with your own custom logic:
511
+ ```python
512
+ from albus_sdk import Albus
513
+ from albus_sdk.httpclient import AsyncHttpClient
514
+ import httpx
515
+
516
+ class CustomClient(AsyncHttpClient):
517
+ client: AsyncHttpClient
518
+
519
+ def __init__(self, client: AsyncHttpClient):
520
+ self.client = client
521
+
522
+ async def send(
523
+ self,
524
+ request: httpx.Request,
525
+ *,
526
+ stream: bool = False,
527
+ auth: Union[
528
+ httpx._types.AuthTypes, httpx._client.UseClientDefault, None
529
+ ] = httpx.USE_CLIENT_DEFAULT,
530
+ follow_redirects: Union[
531
+ bool, httpx._client.UseClientDefault
532
+ ] = httpx.USE_CLIENT_DEFAULT,
533
+ ) -> httpx.Response:
534
+ request.headers["Client-Level-Header"] = "added by client"
535
+
536
+ return await self.client.send(
537
+ request, stream=stream, auth=auth, follow_redirects=follow_redirects
538
+ )
539
+
540
+ def build_request(
541
+ self,
542
+ method: str,
543
+ url: httpx._types.URLTypes,
544
+ *,
545
+ content: Optional[httpx._types.RequestContent] = None,
546
+ data: Optional[httpx._types.RequestData] = None,
547
+ files: Optional[httpx._types.RequestFiles] = None,
548
+ json: Optional[Any] = None,
549
+ params: Optional[httpx._types.QueryParamTypes] = None,
550
+ headers: Optional[httpx._types.HeaderTypes] = None,
551
+ cookies: Optional[httpx._types.CookieTypes] = None,
552
+ timeout: Union[
553
+ httpx._types.TimeoutTypes, httpx._client.UseClientDefault
554
+ ] = httpx.USE_CLIENT_DEFAULT,
555
+ extensions: Optional[httpx._types.RequestExtensions] = None,
556
+ ) -> httpx.Request:
557
+ return self.client.build_request(
558
+ method,
559
+ url,
560
+ content=content,
561
+ data=data,
562
+ files=files,
563
+ json=json,
564
+ params=params,
565
+ headers=headers,
566
+ cookies=cookies,
567
+ timeout=timeout,
568
+ extensions=extensions,
569
+ )
570
+
571
+ s = Albus(async_client=CustomClient(httpx.AsyncClient()))
572
+ ```
573
+ <!-- End Custom HTTP Client [http-client] -->
574
+
575
+ <!-- Start Resource Management [resource-management] -->
576
+ ## Resource Management
577
+
578
+ The `Albus` 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.
579
+
580
+ [context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
581
+
582
+ ```python
583
+ from albus_sdk import Albus, models
584
+ import os
585
+ def main():
586
+
587
+ with Albus(
588
+ security=models.Security(
589
+ bearer_auth=os.getenv("ALBUS_BEARER_AUTH", ""),
590
+ ),
591
+ ) as albus:
592
+ # Rest of application here...
593
+
594
+
595
+ # Or when using async:
596
+ async def amain():
597
+
598
+ async with Albus(
599
+ security=models.Security(
600
+ bearer_auth=os.getenv("ALBUS_BEARER_AUTH", ""),
601
+ ),
602
+ ) as albus:
603
+ # Rest of application here...
604
+ ```
605
+ <!-- End Resource Management [resource-management] -->
606
+
607
+ <!-- Start Debugging [debug] -->
608
+ ## Debugging
609
+
610
+ You can setup your SDK to emit debug logs for SDK requests and responses.
611
+
612
+ You can pass your own logger class directly into your SDK.
613
+ ```python
614
+ from albus_sdk import Albus
615
+ import logging
616
+
617
+ logging.basicConfig(level=logging.DEBUG)
618
+ s = Albus(debug_logger=logging.getLogger("albus_sdk"))
619
+ ```
620
+
621
+ You can also enable a default debug logger by setting an environment variable `ALBUS_DEBUG` to true.
622
+ <!-- End Debugging [debug] -->
623
+
624
+ <!-- Placeholder for Future Speakeasy SDK Sections -->
625
+
626
+ # Development
627
+
628
+ ## Regeneration
629
+
630
+ Regeneration requires `uv`, Speakeasy authentication, and the Speakeasy CLI
631
+ version pinned in `.speakeasy/workflow.yaml`.
632
+
633
+ Run the generator with the authoritative private OpenAPI specification and the
634
+ SDK version to produce:
635
+
636
+ ```bash
637
+ ./tools/generate /path/to/albus/api/openapi.yaml 0.1.0
638
+ ```
639
+
640
+ The command copies the exact specification snapshot into this repository,
641
+ generates the SDK without uploading the specification, normalizes known
642
+ generator metadata, and runs the complete local check. Review and commit the
643
+ specification, generated code, documentation, and lock files together.
644
+
645
+ ## Checks
646
+
647
+ Install `uv` and the pinned Speakeasy CLI, then run the complete local check:
648
+
649
+ ```bash
650
+ ./tools/check
651
+ ```
652
+
653
+ This lints the OpenAPI snapshot, checks the generated package with MyPy and
654
+ Pyright, runs the handwritten tests, builds both package formats, validates
655
+ their metadata, and installs the wheel on Python 3.10 and 3.14.
656
+
657
+ ## Releases
658
+
659
+ Publishing is manual during the MVP. Follow [RELEASING.md](https://github.com/albusgroup/albus-python/blob/master/RELEASING.md) to
660
+ validate and publish a generated version with the guarded local script.
661
+
662
+ ## Maturity
663
+
664
+ This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
665
+ to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
666
+ looking for the latest version.
667
+
668
+ ## Contributions
669
+
670
+ 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.
671
+ 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.
672
+
673
+ ### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=albus-sdk&utm_campaign=python)