pyone

raw JSON →
7.2.0 verified Fri May 01 auth: no python

Python bindings for the OpenNebula XML-RPC API. Current version: 7.2.0. Release cadence is irregular, tied to OpenNebula releases.

pip install pyone
error ModuleNotFoundError: No module named 'pyone'
cause The package is not installed or is installed in a different environment.
fix
Run pip install pyone in your active environment.
error pyone.OneException: [401] Unauthorized
cause Invalid credentials or expired session token.
fix
Verify your username and password. If using a token, ensure it is still valid and pass it as password.
error TypeError: __init__() got an unexpected keyword argument 'session'
cause The `session` argument was removed in pyone 7.x.
fix
Do not pass session; directly authenticate with server, user, password.
breaking In version 7.x, the `One` constructor no longer accepts positional arguments for `server`, `user`, `password`; you must use keyword arguments or a dict.
fix Use `One(server=server, user=user, password=password)` instead of `One(server, user, password)`.
deprecated The `One` class method `login` is deprecated; authentication should be done via the constructor.
fix Pass credentials directly to `One()` instead of calling `.login()`.
gotcha Many methods return a list of objects, but some return a dict. Always check the return type, especially for `one.vm.list()` which returns a list of dicts, not VM objects.
fix Examine the raw response or use `pprint` to understand the structure.

Connect to an OpenNebula instance and fetch version info.

import os
from pyone import One, OneException

server = 'https://your-opennebula-host:2633/RPC2'
user = 'user'
password = os.environ.get('ONE_PASSWORD', '')  # use env var for auth

client = One(server, user, password)
try:
    version_info = client.one.system.version()
    print('OpenNebula version:', version_info)
except OneException as e:
    print('Error:', e)