Skip to content
This repository was archived by the owner on Sep 12, 2025. It is now read-only.

Commit d28d104

Browse files
committed
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.540.0
1 parent 3c47237 commit d28d104

126 files changed

Lines changed: 6128 additions & 2360 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.speakeasy/temp/
2+
.speakeasy/reports
13
.venv/
24
src/*.egg-info/
35
.python-version

.speakeasy/gen.lock

Lines changed: 265 additions & 119 deletions
Large diffs are not rendered by default.

.speakeasy/gen.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ generation:
1010
useClassNamesForArrayFields: true
1111
fixes:
1212
nameResolutionDec2023: true
13+
nameResolutionFeb2025: false
1314
parameterOrderingFeb2024: true
1415
requestResponseComponentNamesFeb2024: true
16+
securityFeb2025: false
1517
auth:
1618
oAuth2ClientCredentialsEnabled: true
1719
oAuth2PasswordEnabled: false
1820
python:
19-
version: 0.9.0
21+
version: 0.10.0
2022
additionalDependencies:
2123
dev: {}
2224
main: {}
@@ -25,6 +27,7 @@ python:
2527
clientServerStatusCodesAsErrors: true
2628
defaultErrorName: SDKError
2729
description: Python Client SDK for unkey.com.
30+
enableCustomCodeRegions: false
2831
enumFormat: enum
2932
envVarPrefix: UNKEY
3033
fixFlags:
@@ -45,5 +48,6 @@ python:
4548
methodArguments: infer-optional-args
4649
outputModelSuffix: output
4750
packageName: unkey.py
51+
pytestTimeout: 0
4852
responseFormat: envelope-http
4953
templateVersion: v2

.speakeasy/workflow.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
speakeasyVersion: 1.453.4
1+
speakeasyVersion: 1.540.0
22
sources:
33
Unkey-OAS:
44
sourceNamespace: unkey-oas
5-
sourceRevisionDigest: sha256:8195101f876a2dee27540ad46a0ff11904f6f41eaab663ca7e6d6ec88adf8c68
6-
sourceBlobDigest: sha256:2ec7e32aea77a854bdd608875cfcd1110ba479f365389e3707bfff61885ff102
5+
sourceRevisionDigest: sha256:87b7088b14a4906fc3a9d47a6426aa4e2bb5e327048c3bfb05c92013b8ccfd0c
6+
sourceBlobDigest: sha256:90a47f37016a08f227995de7d5aae2bf27a7ec8e63ce9e722b2243d161307128
77
tags:
88
- latest
9-
- speakeasy-sdk-regen-1730334330
9+
- speakeasy-sdk-regen-1739752037
1010
- 1.0.0
1111
targets:
1212
unkey:
1313
source: Unkey-OAS
1414
sourceNamespace: unkey-oas
15-
sourceRevisionDigest: sha256:8195101f876a2dee27540ad46a0ff11904f6f41eaab663ca7e6d6ec88adf8c68
16-
sourceBlobDigest: sha256:2ec7e32aea77a854bdd608875cfcd1110ba479f365389e3707bfff61885ff102
15+
sourceRevisionDigest: sha256:87b7088b14a4906fc3a9d47a6426aa4e2bb5e327048c3bfb05c92013b8ccfd0c
16+
sourceBlobDigest: sha256:90a47f37016a08f227995de7d5aae2bf27a7ec8e63ce9e722b2243d161307128
1717
codeSamplesNamespace: unkey-oas-python-code-samples
18-
codeSamplesRevisionDigest: sha256:4c557e4115ee27d060ee91bebe3faa42dfaea6651b128997b9f722c7992a96fc
18+
codeSamplesRevisionDigest: sha256:2df834896b75976a16a6ccc505428d2e9553bfdb2d6366942ca24cb389635359
1919
workflow:
2020
workflowVersion: 1.0.0
2121
speakeasyVersion: latest

README.md

Lines changed: 139 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Developer-friendly & type-safe Python SDK for Unkey's API.
3232
* [Server Selection](#server-selection)
3333
* [Custom HTTP Client](#custom-http-client)
3434
* [Authentication](#authentication)
35+
* [Resource Management](#resource-management)
3536
* [Debugging](#debugging)
3637
* [Development](#development)
3738
* [Maturity](#maturity)
@@ -42,6 +43,11 @@ Developer-friendly & type-safe Python SDK for Unkey's API.
4243
<!-- Start SDK Installation [installation] -->
4344
## SDK Installation
4445

46+
> [!NOTE]
47+
> **Python version upgrade policy**
48+
>
49+
> 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.
50+
4551
The SDK can be installed with either *pip* or *poetry* package managers.
4652

4753
### PIP
@@ -59,6 +65,37 @@ pip install unkey.py
5965
```bash
6066
poetry add unkey.py
6167
```
68+
69+
### Shell and script usage with `uv`
70+
71+
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:
72+
73+
```shell
74+
uvx --from unkey.py python
75+
```
76+
77+
It's also possible to write a standalone Python script without needing to set up a whole project like so:
78+
79+
```python
80+
#!/usr/bin/env -S uv run --script
81+
# /// script
82+
# requires-python = ">=3.9"
83+
# dependencies = [
84+
# "unkey.py",
85+
# ]
86+
# ///
87+
88+
from unkey_py import Unkey
89+
90+
sdk = Unkey(
91+
# SDK arguments
92+
)
93+
94+
# Rest of script here...
95+
```
96+
97+
Once that is saved to a file, you can run it with `uv run script.py` where
98+
`script.py` can be replaced with the actual file name.
6299
<!-- End SDK Installation [installation] -->
63100

64101
<!-- Start IDE Support [idesupport] -->
@@ -80,14 +117,17 @@ Generally, the SDK will work well with most IDEs out of the box. However, when u
80117
# Synchronous Example
81118
from unkey_py import Unkey
82119

120+
83121
with Unkey(
84122
bearer_auth="UNKEY_ROOT_KEY",
85-
) as s:
86-
res = s.liveness.check()
123+
) as unkey:
124+
125+
res = unkey.liveness.check()
87126

88-
if res.object is not None:
89-
# handle response
90-
pass
127+
assert res.object is not None
128+
129+
# Handle response
130+
print(res.object)
91131
```
92132

93133
</br>
@@ -99,14 +139,17 @@ import asyncio
99139
from unkey_py import Unkey
100140

101141
async def main():
142+
102143
async with Unkey(
103144
bearer_auth="UNKEY_ROOT_KEY",
104-
) as s:
105-
res = await s.liveness.check_async()
145+
) as unkey:
106146

107-
if res.object is not None:
108-
# handle response
109-
pass
147+
res = await unkey.liveness.check_async()
148+
149+
assert res.object is not None
150+
151+
# Handle response
152+
print(res.object)
110153

111154
asyncio.run(main())
112155
```
@@ -118,6 +161,10 @@ asyncio.run(main())
118161
<details open>
119162
<summary>Available methods</summary>
120163

164+
### [analytics](docs/sdks/analytics/README.md)
165+
166+
* [get_verifications](docs/sdks/analytics/README.md#get_verifications)
167+
121168
### [apis](docs/sdks/apis/README.md)
122169

123170
* [get](docs/sdks/apis/README.md#get)
@@ -173,7 +220,7 @@ asyncio.run(main())
173220

174221
### [ratelimit](docs/sdks/ratelimit/README.md)
175222

176-
* [ratelimit_set_override](docs/sdks/ratelimit/README.md#ratelimit_set_override)
223+
* [set_override](docs/sdks/ratelimit/README.md#set_override)
177224
* [list_overrides](docs/sdks/ratelimit/README.md#list_overrides)
178225
* [get_override](docs/sdks/ratelimit/README.md#get_override)
179226

@@ -197,18 +244,17 @@ Here's an example of one such pagination call:
197244
```python
198245
from unkey_py import Unkey
199246

247+
200248
with Unkey(
201249
bearer_auth="UNKEY_ROOT_KEY",
202-
) as s:
203-
res = s.identities.list(limit=100)
250+
) as unkey:
251+
252+
res = unkey.identities.list()
204253

205-
if res.object is not None:
206-
while True:
207-
# handle items
254+
while res is not None:
255+
# Handle items
208256

209-
res = res.next()
210-
if res is None:
211-
break
257+
res = res.next()
212258

213259
```
214260
<!-- End Pagination [pagination] -->
@@ -220,35 +266,41 @@ Some of the endpoints in this SDK support retries. If you use the SDK without an
220266

221267
To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
222268
```python
223-
from unkey.utils import BackoffStrategy, RetryConfig
224269
from unkey_py import Unkey
270+
from unkey_py.utils import BackoffStrategy, RetryConfig
271+
225272

226273
with Unkey(
227274
bearer_auth="UNKEY_ROOT_KEY",
228-
) as s:
229-
res = s.liveness.check(,
275+
) as unkey:
276+
277+
res = unkey.liveness.check(,
230278
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
231279

232-
if res.object is not None:
233-
# handle response
234-
pass
280+
assert res.object is not None
281+
282+
# Handle response
283+
print(res.object)
235284

236285
```
237286

238287
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:
239288
```python
240-
from unkey.utils import BackoffStrategy, RetryConfig
241289
from unkey_py import Unkey
290+
from unkey_py.utils import BackoffStrategy, RetryConfig
291+
242292

243293
with Unkey(
244294
retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
245295
bearer_auth="UNKEY_ROOT_KEY",
246-
) as s:
247-
res = s.liveness.check()
296+
) as unkey:
297+
298+
res = unkey.liveness.check()
248299

249-
if res.object is not None:
250-
# handle response
251-
pass
300+
assert res.object is not None
301+
302+
# Handle response
303+
print(res.object)
252304

253305
```
254306
<!-- End Retries [retries] -->
@@ -276,6 +328,7 @@ When custom error responses are specified for an operation, the SDK may also rai
276328
| models.ErrForbidden | 403 | application/json |
277329
| models.ErrNotFound | 404 | application/json |
278330
| models.ErrConflict | 409 | application/json |
331+
| models.ErrPreconditionFailed | 412 | application/json |
279332
| models.ErrTooManyRequests | 429 | application/json |
280333
| models.ErrInternalServerError | 500 | application/json |
281334
| models.SDKError | 4XX, 5XX | \*/\* |
@@ -285,16 +338,19 @@ When custom error responses are specified for an operation, the SDK may also rai
285338
```python
286339
from unkey_py import Unkey, models
287340

341+
288342
with Unkey(
289343
bearer_auth="UNKEY_ROOT_KEY",
290-
) as s:
344+
) as unkey:
291345
res = None
292346
try:
293-
res = s.liveness.check()
294347

295-
if res.object is not None:
296-
# handle response
297-
pass
348+
res = unkey.liveness.check()
349+
350+
assert res.object is not None
351+
352+
# Handle response
353+
print(res.object)
298354

299355
except models.ErrBadRequest as e:
300356
# handle e.data: models.ErrBadRequestData
@@ -311,6 +367,9 @@ with Unkey(
311367
except models.ErrConflict as e:
312368
# handle e.data: models.ErrConflictData
313369
raise(e)
370+
except models.ErrPreconditionFailed as e:
371+
# handle e.data: models.ErrPreconditionFailedData
372+
raise(e)
314373
except models.ErrTooManyRequests as e:
315374
# handle e.data: models.ErrTooManyRequestsData
316375
raise(e)
@@ -328,19 +387,22 @@ with Unkey(
328387

329388
### Override Server URL Per-Client
330389

331-
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:
390+
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:
332391
```python
333392
from unkey_py import Unkey
334393

394+
335395
with Unkey(
336396
server_url="https://api.unkey.dev",
337397
bearer_auth="UNKEY_ROOT_KEY",
338-
) as s:
339-
res = s.liveness.check()
398+
) as unkey:
399+
400+
res = unkey.liveness.check()
340401

341-
if res.object is not None:
342-
# handle response
343-
pass
402+
assert res.object is not None
403+
404+
# Handle response
405+
print(res.object)
344406

345407
```
346408
<!-- End Server Selection [server] -->
@@ -441,18 +503,48 @@ To authenticate with the API the `bearer_auth` parameter must be set when initia
441503
```python
442504
from unkey_py import Unkey
443505

506+
444507
with Unkey(
445508
bearer_auth="UNKEY_ROOT_KEY",
446-
) as s:
447-
res = s.liveness.check()
509+
) as unkey:
448510

449-
if res.object is not None:
450-
# handle response
451-
pass
511+
res = unkey.liveness.check()
512+
513+
assert res.object is not None
514+
515+
# Handle response
516+
print(res.object)
452517

453518
```
454519
<!-- End Authentication [security] -->
455520

521+
<!-- Start Resource Management [resource-management] -->
522+
## Resource Management
523+
524+
The `Unkey` 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.
525+
526+
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
527+
528+
```python
529+
from unkey_py import Unkey
530+
def main():
531+
532+
with Unkey(
533+
bearer_auth="UNKEY_ROOT_KEY",
534+
) as unkey:
535+
# Rest of application here...
536+
537+
538+
# Or when using async:
539+
async def amain():
540+
541+
async with Unkey(
542+
bearer_auth="UNKEY_ROOT_KEY",
543+
) as unkey:
544+
# Rest of application here...
545+
```
546+
<!-- End Resource Management [resource-management] -->
547+
456548
<!-- Start Debugging [debug] -->
457549
## Debugging
458550

0 commit comments

Comments
 (0)