Skip to content

Python Administration Examples

The administration package demonstrates user management and retains two explicitly marked legacy settings operations.

Terminal window
uv run -m administration.users --insecure list

This calls GET /admin/user and displays usernames and group membership. The authenticated API key requires the corresponding administration role.

Terminal window
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.

Deletion requires interactive confirmation:

Terminal window
uv run -m administration.users --insecure delete api-operator

Use --yes only in controlled automation after independently validating the target username.

Terminal window
uv run -m administration.legacy_settings --insecure organization
uv run -m administration.legacy_settings --insecure validator
  • 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.