MAAS API Client
raw JSON → 0.1.1 verified Mon Apr 27 auth: no python
An API client library for interacting with MAAS (Metal as a Service) instances. Provides a Pythonic interface to manage machines, networks, and other MAAS resources. Current version 0.1.1, released March 2025. Release cadence is irregular.
pip install maas-api Common errors
error ModuleNotFoundError: No module named 'maas_api' ↓
cause Package not installed or wrong import name.
fix
Run: pip install maas-api
error machines.list() returns empty list even though machines exist ↓
cause Missing or incorrect API key or URL.
fix
Check MAAS_URL and MAAS_API_KEY environment variables. Ensure API key has correct permissions.
Warnings
breaking The package was renamed from 'maas' to 'maas-api'. If you have 'maas' installed, uninstall it first to avoid conflicts. ↓
fix pip uninstall maas && pip install maas-api
deprecated Old import path 'from maas import MAASClient' no longer works. Use 'from maas_api import MAASClient'. ↓
fix Change imports to 'from maas_api import MAASClient'
gotcha API key must be in the format 'consumer-key:token-key:token-secret'. If using a different format, authentication will fail silently. ↓
fix Ensure MAAS_API_KEY is in the correct colon-separated format.
Imports
- MAASClient wrong
from maas import MAASClientcorrectfrom maas_api import MAASClient
Quickstart
from maas_api import MAASClient
client = MAASClient(
url=os.environ.get('MAAS_URL', 'http://localhost:5240/MAAS'),
api_key=os.environ.get('MAAS_API_KEY', ''),
)
machines = client.machines.list()
print(machines)