Python client library for the Hudu API
Project description
hudu-magic
A tiny, enum-driven, class-based Python API client for Hudu.
- Minimal dependencies (requests)
- Generated from OpenAPI
- Low Maintenance
- Designed for clarity and maintainability
Quick Start
from hudu_magic import HuduClient
client = HuduClient(
api_key="your_api_key",
instance_url="https://yourinstance.huducloud.com"
)
company = client.companies.create(name="Test Company")
# Use a real asset_layout_id from your Hudu instance (e.g. from client.asset_layouts.list()).
asset = client.assets.create(
company_id=company.id,
name="Router",
asset_layout_id=1,
)
asset.name = "Updated Router"
asset.save()
asset.delete()
Installation
Install package
pip install hudu-magic
Usage Info and Guide
There are several examples in the examples folder that might be helpful if you're just starting out
Core Concepts
Client
Handles auth, requests, pagination, wrapping.
client.assets.list()
Collections
Collection-level operations:
- list()
- get()
- create()
- delete()
- archive()
- unarchive()
assetsforcompany.save()
assetsforcompany.delete()
assetsforcompany.archive()
Models (HuduObject)
Instance-level operations:
- save()
- delete()
- refresh()
- relate_to()
- list_photos()
- list_uploads()
- relate_to()
- upload_to()
asset.save()
asset.delete()
Special Model Methods
Assets
someasset.add_public_photo("smile.png")
someasset.add_photo("dogslaughing.jpeg")
some objects can be attributed directly to or uploaded to assets
Companies
mycompany.list_assets()
mycompany.list_articles()
mycompany.list_passwords()
mycompany.list_procedures()
mycompany.list_websites()
mycompany.list_folders()
mycompany.list_password_folders()
mycompany.create_website()
mycompany.create_password()
mycompany.create_procedure()
mycompany.create_article()
mycompany.create_asset()
objects that require or can be attributed to a company often can be listed or created directly from a company object
Procedures and Tasks
myprocedure.kick_off()
myprocedure.kickoff()
myprocedure.start()
myprocedure.is_run
someprocedure.list_tasks()
someotherprocedure.tasks
myprocedure.tasks[0].assign(ouruser)
client.procedure_tasks.get(5).assign(ourotheruser)
sometask.assign_user(mypersonaluser)
Starting a procedure with start, kick_off or kickoff methods results in new procedure [as-a-run] object. Runs still are procedures, and use the same model, but they and their tasks are slightly different.
you can call is_run property (bool) on a procedure to check if it has been started (and therefore, a run)
procedures that have tasks created already will have a huducollection of procedure_task
proceduretasks can be assigned if the parent procedure has been started. like 'assigned_users', a task can only be assigned 'due_date', 'priority',
you can assign a user using a user's id or a user object directly.
Users
myuser.assign_task(thistask)
myotheruser.assign_task(client.proceduretasks.get(56))
you can assign a task directly to a user object
Others
there are many other handy and helpful class methods and many more that are planned. Whenever possible, I'll update this section with specific examples.
Creating Objects
The create base method for all objects is simple. you can specify properties in either the payload object (standard dictionary) or as kwargs (just propertyname=value)
This means you can use either:
kwargs (recommended)
client.assets.create(name="Router", company_id=1, asset_layout_id=10)
dict payload
client.assets.create(payload={"name": "Router", "company_id": 1, "asset_layout_id": 10})
Updating Objects
asset.name = "New Name"
asset.save()
or
asset.update(name="New Name")
Relations
asset.relate_to(website)
or
client.relations.create(from_obj=asset, to_obj=website)
Uploads
asset.upload_to("file.zip")
uploads = asset.list_uploads()
Photos
asset.add_photo("image.png")
photos = asset.list_photos()
Generating builds for new Hudu versions or previous versions
-
Place openapi spec file https://yoururl.huducloud.com/api-docs.json in project directory as hudu-openapiv1.json
-
run
python generate_endpoints.pyafter sourcing virtual environment (that has dev dependencies installed) -
run
./build.sh
todo: .\build.ps1
this is designed to be super simple so that subsequent releases can eventually just be automatically generated, tested, validated, and pushed to pypi.
Note on building and tests
- Run tests with
./build.sh --test(orpytestfrom a dev environment withpip install -e ".[dev]"). - Integration tests are skipped unless you set
HUDU_RUN_INTEGRATION=1. With that set, copytestenv.exampletotestenvand fill inHUDU_TEST_API_KEYandHUDU_TEST_INSTANCE.
Error Handling, Additional Info / Help
If more information is needed, you can call this method on class members to get all associated info from hudu's API spec-
huduobject.help()
For resources such as client.assets, you can call:
client.assets.describe()
or for more verbose info:
client.assets.help()
if an object type or resource doesnt support a method call or payload param, you'll be notified of which one(s), if any, are invalid.
Advanced Use Possibilities
Multi-Client
You can instantiate two or more client objects, like above, to transfer data from, say, your dev instance to production. This hasn't been extensively tested expecially for objects dependent on companies (assets, passwordfolders)
client2.assets.create(
**client1.assets.get(6).to_dict()
)
Philosophy
- Simple > clever
- Explicit > implicit
- Thin wrapper over Hudu API
License
MIT
Versioning convention
PyPI releases use a library SemVer prefix and a numeric suffix derived from the Hudu OpenAPI spec used to generate HuduEndpoint and related code:
MAJOR.MINOR.HUDUSPECVERSION
-
MAJOR/MINOR— reserved for this Python package (breaking API changes, larger feature sets, and so on). -
HUDUSPECVERSION— encodes the spec’s(major, minor, patch)as a single integer:hudu_spec_major * 1000 + hudu_spec_minor * 10 + hudu_spec_patchExample: OpenAPI 2.41.0 →
2 * 1000 + 41 * 10 + 0= 2410 → package segment 0.1.2410 (with0.1as the current library prefix).
When Hudu publishes a new spec, regenerate and bump HUDUSPECVERSION accordingly. For Python-only fixes (same spec, no regeneration), prefer a PEP 440 suffix such as 0.1.2410.post1 so the encoded spec stays honest.
Spec used for the current release: Hudu OpenAPI 2.41.0 (as of 2026-04-06). The canonical package version is in pyproject.toml.
History
Hudu 2.41.0 Spec
-
v0.1.2410 - Apr 6, 2026; Initial Release
-
v0.2.2410 - Apr 7, 2026; added validation, differentiation for procedure-vs-run and task-vs-runtask, as well as some helpful class methods.
Project details
Release history Release notifications | RSS feed
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 hudu_magic-0.2.2410.tar.gz.
File metadata
- Download URL: hudu_magic-0.2.2410.tar.gz
- Upload date:
- Size: 45.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9959507a6822ada612326fe55b2793ee4304badd772934062cd8dbd235a19212
|
|
| MD5 |
1d98fa4c9e6f68fadc06ebd9d8c2c077
|
|
| BLAKE2b-256 |
c4c5e8b40e7a80b07e93f78df8955df4f396a3180673ea259599ac32693676df
|
Provenance
The following attestation bundles were made for hudu_magic-0.2.2410.tar.gz:
Publisher:
publish-pypi.yml on Hudu-Technologies-Inc/hudu-magic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hudu_magic-0.2.2410.tar.gz -
Subject digest:
9959507a6822ada612326fe55b2793ee4304badd772934062cd8dbd235a19212 - Sigstore transparency entry: 1248672470
- Sigstore integration time:
-
Permalink:
Hudu-Technologies-Inc/hudu-magic@fcb4c73371db56fb79557f72726cda55126f47ac -
Branch / Tag:
refs/tags/0.2.2410 - Owner: https://github.com/Hudu-Technologies-Inc
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@fcb4c73371db56fb79557f72726cda55126f47ac -
Trigger Event:
release
-
Statement type:
File details
Details for the file hudu_magic-0.2.2410-py3-none-any.whl.
File metadata
- Download URL: hudu_magic-0.2.2410-py3-none-any.whl
- Upload date:
- Size: 45.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc190c0863d595e1772f82946bf5fa0d236ccfb7c11b35aa370a1f8a2b0b6a23
|
|
| MD5 |
c8440f71bc20d14c2782353002b0fb6c
|
|
| BLAKE2b-256 |
0b7b091f8471b0cd0e848b871ffd95a6f2079bc4237ddbe4105cd64992908421
|
Provenance
The following attestation bundles were made for hudu_magic-0.2.2410-py3-none-any.whl:
Publisher:
publish-pypi.yml on Hudu-Technologies-Inc/hudu-magic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hudu_magic-0.2.2410-py3-none-any.whl -
Subject digest:
bc190c0863d595e1772f82946bf5fa0d236ccfb7c11b35aa370a1f8a2b0b6a23 - Sigstore transparency entry: 1248672477
- Sigstore integration time:
-
Permalink:
Hudu-Technologies-Inc/hudu-magic@fcb4c73371db56fb79557f72726cda55126f47ac -
Branch / Tag:
refs/tags/0.2.2410 - Owner: https://github.com/Hudu-Technologies-Inc
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@fcb4c73371db56fb79557f72726cda55126f47ac -
Trigger Event:
release
-
Statement type: