Skip to main content

Lint Build

Python Module for TrueNAS Websocket API

This python module utilizes the TrueNAS Websocket API to get state from a TrueNAS instance.

Installation

pip install aiotruenas-client

Usage

from aiotruenas_client import CachingMachine as TrueNASMachine

machine = await TrueNASMachine.create(
    "hostname.of.machine",
    api_key="someapikey"
)
datasets = await machine.get_datasets()
disks = await machine.get_disks()
jails = await machine.get_jails()
pools = await machine.get_pools()
vms = await machine.get_vms()

Alternatively, a username and password may also be supplied.

Machine

Object representing a TrueNAS instance.

Dataset

Available from machine.datasets, contains information about the datasets on the pools on the machine.

Disk

Available from machine.disks, contains information about the disks attached to the machine.

Jail

Available from machine.jails, contains information about the jails available on the machine.

Pool

Available from machine.pools, contains information about the ZFS pools known to the machine.

VirturalMachine

Available from machine.vms, contains information about the virtural machines available on the machine.

Each instance has the following methods availabe:

  • vm.start
  • vm.stop
  • vm.restart

Development

Setup

python3.8 -m venv .venv
source .venv/bin/activate

# Install Requirements
pip install -r requirements.txt

# Install Dev Requirements
pip install -r requirements-dev.txt

# One-Time Install of Commit Hooks
pre-commit install

Working With Methods & Subscriptions

When adding support for a new object, or updating existing code, it can be useful to see the raw response from the TrueNAS machine from time to time. In order to help do that easily, you can drop a .auth.yaml file in the root of the repository, with the following content:

host: "some.host.name"
api_key: "someapikey"

Use scripts/invoke_method.py to call a method:

python scripts/invoke_method.py disk.query

Use scripts/subscribe.py to subscribe to a topic:

python scripts/subscribe.py reporting.realtime

Run either with -h to see additional options.

Testing

Tests are run with pytest.

Metadata

Release files for aiotruenas-client 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiotruenas-client 0.10.0
File Size Uploaded Provenance
aiotruenas-client-0.10.0.tar.gz 17.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aiotruenas-client 0.10.0
File Interpreter ABI Platform
aiotruenas_client-0.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 42.3 kB

Release files / aiotruenas-client-0.10.0.tar.gz

Download URL aiotruenas-client-0.10.0.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
edb35e29cf89f0b94f11ccbd52ac1d029738cb5c6454cb4f309d7ce71ee19728
BLAKE2b-256 checksum
How to use checksums
4d2cdccc5df35587b4afe9f209f37eb606cffc199d71bf9b6d8ba92b41127a92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.3

Release files / aiotruenas_client-0.10.0-py3-none-any.whl

Download URL aiotruenas_client-0.10.0-py3-none-any.whl
Size 25.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3eccb1ffeca9d01dd4ca4ce0fb8c92490b7c070729d6e1f8c40066f9fa2351d9
BLAKE2b-256 checksum
How to use checksums
b92e9bb45f42866d4689e96404d7742a402f2e0d71b4271840048d1f2fac6ab2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.3

Security for aiotruenas-client 0.10.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page