I have just pushed some changes to the Horizon Python module. With these changes I am more complying with the Python coding standards by initiating an object before being able to use the functions inside a class. Also I added a bunch of the api calls available in the monitor parts.
To connect you now start like this:
import requests, getpass import vmware_horizon requests.packages.urllib3.disable_warnings() url = input("URL\n") username = input("Username\n") domain = input("Domain\n") pw = getpass.getpass() hvconnectionobj = vmware_horizon.Connection(username = username,domain = domain,password = pw,url = url) hvconnectionobj.hv_connect()
so technically you first initiate a Connection class object and than you use the hv_connect function inside that class after which the access token is stored inside the object itself.
Now to use the monitors for example you create an object for this.
monitor = vmware_horizon.Monitor(url=hvconnectionobj.url, access_token=hvconnectionobj.access_token)
To see what functions are available you can combine print with dir.
and the full list, the ones with (id) require an id:
As you can see I had to work with underscores instead of hyphens as python doesn’t like those in the names of functions
Todo: Error handling for wrong passwords, documentation