Async client for NanoKVM devices.
Project description
python-nanokvm
Async Python client for NanoKVM.
Usage
from nanokvm.client import NanoKVMClient
from nanokvm.models import GpioType, MouseButton
# NanoKVM (auto-detects password mode)
async with NanoKVMClient("https://kvm.local/api/") as client:
await client.authenticate("username", "password")
# Get device information
dev = await client.get_info()
hw = await client.get_hardware()
gpio = await client.get_gpio()
# List available images
images = await client.get_images()
# Keyboard input
await client.paste_text("Hello\nworld!")
# Mouse control
await client.mouse_click(MouseButton.LEFT, 0.5, 0.5)
await client.mouse_move_abs(0.25, 0.75)
await client.mouse_scroll(0, -3)
# Stream video
async for frame in client.mjpeg_stream():
print(frame)
# Control GPIO
await client.push_button(GpioType.POWER, duration_ms=1000)
SSH Usage
from nanokvm.ssh_client import NanoKVMSSH
# Create SSH client
ssh = NanoKVMSSH("kvm-8b76.local")
await ssh.authenticate("password")
# Run commands
uptime = await ssh.run_command("cat /proc/uptime")
disk = await ssh.run_command("df -h /")
await ssh.disconnect()
Password Obfuscation Modes
By default, the client auto-detects the correct password mode. It tries obfuscated password first, and falls back to plain text if authentication fails. You can also force a specific mode:
# Auto-detect (default) — recommended
async with NanoKVMClient("https://kvm.local/api/") as client:
await client.authenticate("username", "password")
# Force plain text (newer NanoKVM with HTTPS)
async with NanoKVMClient(
"https://kvm.local/api/",
use_password_obfuscation=False
) as client:
await client.authenticate("username", "password")
# Force obfuscation (older NanoKVM with HTTP)
async with NanoKVMClient(
"http://kvm.local/api/",
use_password_obfuscation=True
) as client:
await client.authenticate("username", "password")
HTTPS/SSL Configuration
The client supports HTTPS connections with flexible SSL/TLS configuration options.
Standard HTTPS (Let's Encrypt, Public CA)
For modern NanoKVM devices with HTTPS and valid certificates:
async with NanoKVMClient("https://kvm.local/api/") as client:
await client.authenticate("username", "password")
Self-Signed Certificates
For self-signed certificates, you have two options:
Option 1: Disable verification (testing only)
Warning: This is insecure and should only be used for testing!
async with NanoKVMClient(
"https://kvm.local/api/",
verify_ssl=False,
) as client:
await client.authenticate("username", "password")
Option 2: Certificate pinning (recommended for self-signed)
NanoKVM devices generate self-signed certificates for localhost with no CA to verify against. Certificate pinning verifies the server's certificate fingerprint directly instead of relying on CA-based trust.
from nanokvm.utils import async_fetch_remote_fingerprint
# First, fetch the fingerprint (trust-on-first-use)
fingerprint = await async_fetch_remote_fingerprint("https://kvm.local/api/")
# Then connect with the pinned fingerprint
async with NanoKVMClient(
"https://kvm.local/api/",
ssl_fingerprint=fingerprint,
) as client:
await client.authenticate("username", "password")
Option 3: Use custom CA certificate
async with NanoKVMClient(
"https://kvm.local/api/",
ssl_ca_cert="/path/to/ca.pem",
) as client:
await client.authenticate("username", "password")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nanokvm-1.0.0.tar.gz.
File metadata
- Download URL: nanokvm-1.0.0.tar.gz
- Upload date:
- Size: 24.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9aa18dcc6829d7df9595ffa5198da279913d55e7cbef879ea35933f6bea78827
|
|
| MD5 |
432317d80e2df9f8e222eda5daa9136b
|
|
| BLAKE2b-256 |
d2a56db773f1c178c02b1f08803bc915f5f0b525e50e2d23f9e33869134a4063
|
Provenance
The following attestation bundles were made for nanokvm-1.0.0.tar.gz:
Publisher:
publish-to-pypi.yml on puddly/python-nanokvm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nanokvm-1.0.0.tar.gz -
Subject digest:
9aa18dcc6829d7df9595ffa5198da279913d55e7cbef879ea35933f6bea78827 - Sigstore transparency entry: 1058129849
- Sigstore integration time:
-
Permalink:
puddly/python-nanokvm@7bc86f3cf4ad1e40ed72a9c59fb8e39cfabc260b -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/puddly
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@7bc86f3cf4ad1e40ed72a9c59fb8e39cfabc260b -
Trigger Event:
release
-
Statement type:
File details
Details for the file nanokvm-1.0.0-py3-none-any.whl.
File metadata
- Download URL: nanokvm-1.0.0-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2347bc32c5129ec3d0876116474a4d9aa03d4e4fd7c2f13358db006a94f309af
|
|
| MD5 |
49456626ab76608b760b6d52ea0f3f70
|
|
| BLAKE2b-256 |
3d188edd034697e4ac3df3cf225d528869e159407be9df8644a05dfbc0acc322
|
Provenance
The following attestation bundles were made for nanokvm-1.0.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on puddly/python-nanokvm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nanokvm-1.0.0-py3-none-any.whl -
Subject digest:
2347bc32c5129ec3d0876116474a4d9aa03d4e4fd7c2f13358db006a94f309af - Sigstore transparency entry: 1058129863
- Sigstore integration time:
-
Permalink:
puddly/python-nanokvm@7bc86f3cf4ad1e40ed72a9c59fb8e39cfabc260b -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/puddly
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@7bc86f3cf4ad1e40ed72a9c59fb8e39cfabc260b -
Trigger Event:
release
-
Statement type: