drukbox-python-sdk 0.0.4__py3-none-any.whl → 0.0.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {drukbox_python_sdk-0.0.4.dist-info → drukbox_python_sdk-0.0.6.dist-info}/METADATA +2 -2
- drukbox_python_sdk-0.0.6.dist-info/RECORD +6 -0
- drukbox_sdk/__init__.py +2 -0
- drukbox_sdk/api.py +16 -0
- drukbox_sdk/exceptions.py +9 -0
- drukbox_python_sdk-0.0.4.dist-info/RECORD +0 -6
- {drukbox_python_sdk-0.0.4.dist-info → drukbox_python_sdk-0.0.6.dist-info}/WHEEL +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: drukbox-python-sdk
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.6
|
|
4
4
|
Summary: Async Python client for Drukbox.
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Requires-Dist: httpx>=0.28
|
|
@@ -80,7 +80,7 @@ Supported host operations:
|
|
|
80
80
|
- `aclose`
|
|
81
81
|
|
|
82
82
|
`create_host` supports the service's optional `image`, `env`, `expires_at`,
|
|
83
|
-
and `Idempotency-Key` inputs.
|
|
83
|
+
`provider`, and `Idempotency-Key` inputs.
|
|
84
84
|
|
|
85
85
|
`doctor` fetches `GET /doctor` — read-only dependency health. The service
|
|
86
86
|
runs one cheap, non-mutating probe per dependency (database, active VM
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
drukbox_sdk/__init__.py,sha256=GXf8MpWSrvq-ZVpjbyewSyeoF7rVG3D3rPXUKlDtJTU,790
|
|
2
|
+
drukbox_sdk/api.py,sha256=wThm3hD7ZMDzWQhe4VLMPrDbnkv6BgQpbHQc-4gBAAg,14737
|
|
3
|
+
drukbox_sdk/exceptions.py,sha256=YecxsuwpHhwzgw-_h9KbXf1WqY6R0JIJrwPY3Eg4e6I,2146
|
|
4
|
+
drukbox_python_sdk-0.0.6.dist-info/METADATA,sha256=ffkMD_7mvw4OWt9iGoomxU1ygptC7LH2fB-ULAPJsHQ,3203
|
|
5
|
+
drukbox_python_sdk-0.0.6.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
6
|
+
drukbox_python_sdk-0.0.6.dist-info/RECORD,,
|
drukbox_sdk/__init__.py
CHANGED
|
@@ -18,6 +18,7 @@ from .exceptions import (
|
|
|
18
18
|
SandboxProvisioningError,
|
|
19
19
|
SandboxResponseError,
|
|
20
20
|
SandboxUnavailableError,
|
|
21
|
+
SandboxValidationError,
|
|
21
22
|
)
|
|
22
23
|
|
|
23
24
|
__all__ = [
|
|
@@ -32,4 +33,5 @@ __all__ = [
|
|
|
32
33
|
"SandboxProvisioningError",
|
|
33
34
|
"SandboxResponseError",
|
|
34
35
|
"SandboxUnavailableError",
|
|
36
|
+
"SandboxValidationError",
|
|
35
37
|
]
|
drukbox_sdk/api.py
CHANGED
|
@@ -45,6 +45,7 @@ from .exceptions import (
|
|
|
45
45
|
SandboxProvisioningError,
|
|
46
46
|
SandboxResponseError,
|
|
47
47
|
SandboxUnavailableError,
|
|
48
|
+
SandboxValidationError,
|
|
48
49
|
)
|
|
49
50
|
|
|
50
51
|
# Explicit pool budget. The httpx defaults (100 / 20) are plenty for
|
|
@@ -214,6 +215,7 @@ class SandboxAPI:
|
|
|
214
215
|
expires_at: datetime | None = None,
|
|
215
216
|
idempotency_key: str | None = None,
|
|
216
217
|
image: str | None = None,
|
|
218
|
+
provider: str | None = None,
|
|
217
219
|
) -> SandboxHost:
|
|
218
220
|
"""Provision a new host.
|
|
219
221
|
|
|
@@ -228,6 +230,10 @@ class SandboxAPI:
|
|
|
228
230
|
header. Useful for retry safety on flaky networks — a retry with
|
|
229
231
|
the same key after a successful provision returns the original
|
|
230
232
|
host instead of creating a duplicate.
|
|
233
|
+
|
|
234
|
+
``provider`` pins which VM provider serves the request; omit it to
|
|
235
|
+
use the service default. An unknown provider raises
|
|
236
|
+
:class:`SandboxResponseError` (the service rejects it with 400).
|
|
231
237
|
"""
|
|
232
238
|
|
|
233
239
|
payload: dict[str, Any] = {}
|
|
@@ -237,6 +243,8 @@ class SandboxAPI:
|
|
|
237
243
|
payload["expires_at"] = expires_at.isoformat()
|
|
238
244
|
if image is not None:
|
|
239
245
|
payload["image"] = image
|
|
246
|
+
if provider is not None:
|
|
247
|
+
payload["provider"] = provider
|
|
240
248
|
|
|
241
249
|
headers: dict[str, str] = {}
|
|
242
250
|
if idempotency_key is not None:
|
|
@@ -343,6 +351,14 @@ class SandboxAPI:
|
|
|
343
351
|
if response.status_code == 503:
|
|
344
352
|
raise SandboxUnavailableError(json_response.get("detail", "service unavailable"))
|
|
345
353
|
|
|
354
|
+
if response.status_code == 422:
|
|
355
|
+
# FastAPI's 422 detail is a list of error dicts; join the messages
|
|
356
|
+
# so it reads as a line, not a raw list repr.
|
|
357
|
+
detail = json_response.get("detail", "validation error")
|
|
358
|
+
if isinstance(detail, list):
|
|
359
|
+
detail = "; ".join(item.get("msg", "") for item in detail) or "validation error"
|
|
360
|
+
raise SandboxValidationError(detail)
|
|
361
|
+
|
|
346
362
|
if response.status_code >= 400:
|
|
347
363
|
raise SandboxResponseError(json_response.get("detail", "error"))
|
|
348
364
|
return json_response
|
drukbox_sdk/exceptions.py
CHANGED
|
@@ -50,5 +50,14 @@ class SandboxProvisioningError(SandboxAPIError):
|
|
|
50
50
|
"""
|
|
51
51
|
|
|
52
52
|
|
|
53
|
+
class SandboxValidationError(SandboxAPIError):
|
|
54
|
+
"""422 — the service rejected the request payload as invalid.
|
|
55
|
+
|
|
56
|
+
e.g. an env key that isn't a valid environment-variable name, or a
|
|
57
|
+
proxy target URL carrying a path or credentials. The request is
|
|
58
|
+
malformed, so retrying it unchanged won't help — fix the input.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
|
|
53
62
|
class SandboxResponseError(SandboxAPIError):
|
|
54
63
|
"""Everything else the service returned that the SDK doesn't classify."""
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
drukbox_sdk/__init__.py,sha256=mYIclrOsTbsz9I-0J7eTizXg9s95dGker9SQppmVmrI,732
|
|
2
|
-
drukbox_sdk/api.py,sha256=rZ1MI4zKMiqGNOtAzcPM10Y-Q7ZW3Ly_ZP9cgVqhcDc,13953
|
|
3
|
-
drukbox_sdk/exceptions.py,sha256=eGtoDqmyt5vF0f4AJ4XmOatEe1vVl9KDOfI2YygdA2k,1811
|
|
4
|
-
drukbox_python_sdk-0.0.4.dist-info/METADATA,sha256=aAGDQPkXP6ktJ_yKYbOAaooAmDbqS0lq4fckWJqKgu8,3191
|
|
5
|
-
drukbox_python_sdk-0.0.4.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
6
|
-
drukbox_python_sdk-0.0.4.dist-info/RECORD,,
|
|
File without changes
|