Python Administration Examples
The administration package demonstrates user management and retains two explicitly marked legacy settings operations.
List Users
Section titled “List Users”uv run -m administration.users --insecure listThis calls GET /admin/user and displays usernames and group membership. The authenticated API key requires the corresponding administration role.
Create a User
Section titled “Create a User”uv run -m administration.users --insecure add api-operator \ --group operator \ --description "API operations user"The script prompts for the new user’s password with getpass, so it is not exposed in shell history or process listings. If --group is omitted, the script uses netadmin; review that default before running the command.
Delete a User
Section titled “Delete a User”Deletion requires interactive confirmation:
uv run -m administration.users --insecure delete api-operatorUse --yes only in controlled automation after independently validating the target username.
Legacy Settings
Section titled “Legacy Settings”uv run -m administration.legacy_settings --insecure organizationuv run -m administration.legacy_settings --insecure validatorSafety Notes
Section titled “Safety Notes”- User creation and deletion change Manager state; verify the target system and RBAC scope first.
- Do not supply passwords through command-line arguments or save them in
.env. - Prefer a dedicated, least-privilege API key for automation.
- Keep the deletion confirmation enabled for interactive use.
- Test administrative workflows in a lab before using them in production.