shako-sdk
The Shako API for Python: VMs, ports, backups, secrets, devices, credit and tenants, with an API key.
Each method is one endpoint of the REST API. shako.vms.create(...) is https://shako.dev/api/vms/create, and that
page has each field, its default and the answer.
Install
pip install shako-sdk
Python 3.9 or newer. The package needs no other packages.
API key
Make a key with the CLI, or in the workspace (https://workspace.shako.dev, Account settings › API keys). Shako shows the key only once.
shako api-key create ci --role contributor --tenant acme --days 90
export SHAKO_API_KEY=shk_k_...
Use
from shako_sdk import Shako
shako = Shako() # the key from SHAKO_API_KEY
for vm in shako.vms.list():
print(vm["name"], vm["state"])
shako.vms.create(name="web1", size="small")
print(shako.ports.create("web1", port=8000)["url"])
print(shako.billing.usage()["total_cost"])
shako.vms.delete("web1")
shako.<resource>.<endpoint>: the resources and the endpoints of https://shako.dev/api, with_in place of-(shako.screen_links.create,shako.billing.top_up).- The args of the path are positional:
shako.vms.get("web1"),shako.ports.delete("web1", 8000). - The fields of the query or the body are keyword args:
shako.vms.update("web1", sleep="never"). - An answer is a
dict, and a list is alist. The types are inshako_sdk.types(for exampleVmView).
Tenant
A key for one tenant needs no tenant: the client reads it from GET /v1/whoami once. A key for your account
(shako api-key create ops --role owner --account) needs the tenant:
shako = Shako(tenant="acme") # each request
shako.vms.list(tenant="other") # one request
Errors
An error answer raises ShakoError:
from shako_sdk import ShakoError
try:
shako.billing.top_up(amount=5)
except ShakoError as err:
print(err.code, err.status, err.message)
# forbidden 403 API key ci needs the role owner on acme for credit-add. See shako access ls, ...
The codes: https://shako.dev/api/errors. When no answer comes, the code is unreachable and the status is 0.
An endpoint with no method
shako.request("GET", "/v1/tenants/{tenant}/vms/{name}", {"name": "web1"}) sends any request, and returns the JSON
answer.
Options
Shako(api_key=None, *, tenant=None, base_url=None, timeout=900)
| Option | When it is missing |
|---|---|
api_key |
The environment variable SHAKO_API_KEY. |
tenant |
The tenant of the key, when the key has only one. |
base_url |
The environment variable SHAKO_API, then https://api.shako.dev. |
timeout |
900 seconds for one request. A create waits until the VM boots. |
License
MIT
Metadata
Release files for shako-sdk 0.1.0
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 |
|---|---|---|---|---|
| shako_sdk-0.1.0.tar.gz | 15.4 kB | Without provenance | Details for shako_sdk-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| shako_sdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for shako_sdk-0.1.0-py3-none-any.whl |
Total release size: 29.6 kB
Release files / shako_sdk-0.1.0.tar.gz
| Download URL | shako_sdk-0.1.0.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1742d2753d98b37a4ecb950b714b549b8fab8261eef94720d6fe36f83014912f
|
|
BLAKE2b-256 checksum How to use checksums |
a387f3f00af17adf434de1a3d2a75908300664c65a2cf0e34950d6c82f017a8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.18
|
Release files / shako_sdk-0.1.0-py3-none-any.whl
| Download URL | shako_sdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa5548304eb8b7a52e2616d5f09c4681646243dfe3370de1d25d8df503e614f0
|
|
BLAKE2b-256 checksum How to use checksums |
dd48f0e58b601d543866bff286d85d948193bdf7c5581aa8df4dfd44c330f983
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.18
|
Security for shako-sdk 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.