{"id":13586038,"url":"https://github.com/sdwilsh/aiotruenas-client","last_synced_at":"2025-12-30T08:12:29.297Z","repository":{"id":40481668,"uuid":"286104484","full_name":"sdwilsh/aiotruenas-client","owner":"sdwilsh","description":"An asyncio-friendly API for TrueNAS","archived":false,"fork":false,"pushed_at":"2024-04-28T01:45:07.000Z","size":285,"stargazers_count":17,"open_issues_count":14,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-29T00:15:10.917Z","etag":null,"topics":["freenas","python","truenas"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sdwilsh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-08T19:11:41.000Z","updated_at":"2024-05-01T20:06:16.291Z","dependencies_parsed_at":"2023-10-22T06:23:36.390Z","dependency_job_id":"af615e6a-4b8e-4890-8ca0-1ff4abd9e5df","html_url":"https://github.com/sdwilsh/aiotruenas-client","commit_stats":{"total_commits":171,"total_committers":5,"mean_commits":34.2,"dds":"0.38596491228070173","last_synced_commit":"930f1a4052e4e8ab95567a69cb699f8c6c3dde53"},"previous_names":["sdwilsh/py-freenas"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdwilsh%2Faiotruenas-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdwilsh%2Faiotruenas-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdwilsh%2Faiotruenas-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdwilsh%2Faiotruenas-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sdwilsh","download_url":"https://codeload.github.com/sdwilsh/aiotruenas-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223285008,"owners_count":17119820,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["freenas","python","truenas"],"created_at":"2024-08-01T15:05:17.451Z","updated_at":"2025-12-13T19:29:18.645Z","avatar_url":"https://github.com/sdwilsh.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"![Lint](https://github.com/sdwilsh/aiotruenas-client/workflows/Lint/badge.svg)\n![Build](https://github.com/sdwilsh/aiotruenas-client/workflows/Build/badge.svg)\n\n# Python Module for TrueNAS Websocket API\n\nThis python module utilizes the [TrueNAS Websocket API](https://www.truenas.com/docs/hub/additional-topics/api/websocket_api.html) to get state from a TrueNAS instance.\n\n## Installation\n\n```\npip install aiotruenas-client\n```\n\n## Usage\n\n```python\nfrom aiotruenas_client import CachingMachine as TrueNASMachine\n\nmachine = await TrueNASMachine.create(\n    \"hostname.of.machine\",\n    api_key=\"someapikey\"\n)\ndatasets = await machine.get_datasets()\ndisks = await machine.get_disks()\njails = await machine.get_jails()\npools = await machine.get_pools()\nvms = await machine.get_vms()\n```\n\nAlternatively, a username and password may also be supplied.\n\n### `Machine`\n\nObject representing a TrueNAS instance.\n\n### `Dataset`\n\nAvailable from `machine.datasets`, contains information about the datasets on the pools on the machine.\n\n### `Disk`\n\nAvailable from `machine.disks`, contains information about the disks attached to the machine.\n\n### `Jail`\n\nAvailable from `machine.jails`, contains information about the jails available on the machine.\n\n### `Pool`\n\nAvailable from `machine.pools`, contains information about the ZFS pools known to the machine.\n\n### `VirturalMachine`\n\nAvailable from `machine.vms`, contains information about the virtural machines available on the machine.\n\nEach instance has the following methods availabe:\n\n- `vm.start`\n- `vm.stop`\n- `vm.restart`\n\n## Development\n\n### Setup\n\n```\npython3.8 -m venv .venv\nsource .venv/bin/activate\n\n# Install Requirements\npip install -r requirements.txt\n\n# Install Dev Requirements\npip install -r requirements-dev.txt\n\n# One-Time Install of Commit Hooks\npre-commit install\n```\n\n### Working With Methods \u0026 Subscriptions\n\nWhen adding support for a new object, or updating existing code, it can be useful to see the raw response from the\nTrueNAS machine from time to time. In order to help do that easily, you can drop a `.auth.yaml` file in the root of\nthe repository, with the following content:\n\n```yaml\nhost: \"some.host.name\"\napi_key: \"someapikey\"\n```\n\nUse `scripts/invoke_method.py` to call a method:\n\n```\npython scripts/invoke_method.py disk.query\n```\n\nUse `scripts/subscribe.py` to subscribe to a topic:\n\n```\npython scripts/subscribe.py reporting.realtime\n```\n\nRun either with -h to see additional options.\n\n### Testing\n\nTests are run with `pytest`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdwilsh%2Faiotruenas-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsdwilsh%2Faiotruenas-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdwilsh%2Faiotruenas-client/lists"}