kasm-sdk (Python)
Python client for the Kasm Workspaces API, generated from the official OpenAPI spec.
pip install kasm-sdk
from kasm_sdk import Kasm, NotFoundError
kasm = Kasm("https://kasm.example.com", api_key=key, api_secret=secret)
img = kasm.admin.catalog.images.get(image_id)
kasm.admin.catalog.file_mappings.update(file_map_id, description=None) # None clears it
for zone in kasm.admin.infrastructure.zones.iter():
print(zone.zone_name)
The client's attributes follow kcli's command tree (kcli admin catalog images get is kasm.admin.catalog.images.get). Path parameters are
positional; the request body's fields and the query parameters are keyword
arguments. The whole body can also be passed, as a model from
kasm_sdk.models or a dict, with keyword arguments over it. A method returns
the success reply as its Pydantic model, or None for an operation that
replies with none. Paged lists also have iter, which walks every page,
numbered from 0 as in the API.
A keyword argument left out leaves the field out; None sends null, and is
refused before sending where the API does not take null. The models check
their constraints before sending too (pydantic.ValidationError). A
multipart body takes bytes, a path, a binary file, or (filename, content)
for its file fields.
Every non-2xx reply raises a KasmError subclass by status (NotFoundError,
ConflictError, ValidationError, ForbiddenError, ServerError, ...)
carrying the problem+json fields, field-level errors from a 422, and the
response headers. A problem type whose schema adds fields has a class of
its own under its status's (NoResourcesError is a ConflictError), with
problem its model. A failure before any reply raises KasmConnectionError,
and a 2xx reply that is not the JSON the spec declares, including null,
raises KasmResponseError. A reply field the models do not know is kept, in
model_extra. Printing a model masks its secret fields (api_key_secret,
password, ...); the values themselves are plain strings.
Kasm.from_profile("staging") uses a profile kcli is set up with, through
kcli config credentials: kcli supplies the URL, timeout and TLS setting and
the credential, and renews a password profile's session token. Kasm() with
no arguments is the environment's (KASM_URL, KASM_API_KEY,
KASM_API_KEY_SECRET) when it gives all three, otherwise the active profile.
AsyncKasm has the same methods, awaited, with async for over iter; both
clients are context managers. token= authenticates with a session token,
and token_source= with an object whose token() is asked for a fresh token
once after a 401. Kasm.login(base_url, username, password) signs in and
returns a client acting as that user, which the self-service operations
need. kasm.request sends any operation by method and path. retries=N
sends a GET, PUT or DELETE refused with 429 or 503 again, up to N times,
after the server's Retry-After.
kasm_sdk/_services.py (the methods), kasm_sdk/_schema.py,
kasm_sdk/_problems.py (the problem types' classes) and
kasm_sdk/models.py (from datamodel-code-generator) are generated and never
hand-edited. The tests are
pytest in this directory.
About this repository
This package is generated from the Kasm Workspaces OpenAPI spec, in the same
run as the TypeScript and Go SDKs, and published here from Kasm's kcli
repository: one commit and one vX.Y.Z tag per release, and anything
changed here directly is overwritten by the next. kcli and the three SDKs
share a version number. They are 0.x: no compatibility promise until the
API surface settles.
Licensed under the Apache License 2.0.
Metadata
Release files for kasm-sdk 0.1.188
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kasm_sdk-0.1.188.tar.gz | 236.4 kB | With provenance | Details for kasm_sdk-0.1.188.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kasm_sdk-0.1.188-py3-none-any.whl | Python 3 | none | any | Details for kasm_sdk-0.1.188-py3-none-any.whl |
Total release size: 470.9 kB
Release files / kasm_sdk-0.1.188.tar.gz
| Download URL | kasm_sdk-0.1.188.tar.gz |
|---|---|
| Size | 236.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8397bfb13a8cdf43bcf66d67eb26a735b12eddf940695e1e825f0bf6928026c6
|
|
BLAKE2b-256 checksum How to use checksums |
6366c597f9a419db8f265e78e02eff8bedcdb14fe5e4d9899416f772f42acce5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / kasm_sdk-0.1.188-py3-none-any.whl
| Download URL | kasm_sdk-0.1.188-py3-none-any.whl |
|---|---|
| Size | 234.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ad6bec3d64febda7705ea0ea10eb1eb9c050eed2a8e09c6741807d7ab2f2e27
|
|
BLAKE2b-256 checksum How to use checksums |
5866c65977ec60cce5eccd8588b8298a0c640b2b0e56def7ca582d9bb9734eb8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logSecurity for kasm-sdk 0.1.188
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for kasm_sdk-0.1.188.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.