VMware vcenter client in httpx python library. Can be used for creating scripts for simple VM actions, like power control, snapshot management etc.
Uses VCenter REST API and VCenter SOAP API.
If you use pip:
pip install git+https://github.com/mrtstg/vmware_vcenter_api_client
If you use poetry:
poetry add git+https://github.com/mrtstg/vmware_vcenter_api_client
Client getting authenticated using user credentials that are getting passed into class.
from vmware_vcenter_api_client.client import ApiClient, VM, Folder
# Protocol in the beginning of URL is nececcary
client = ApiClient("https://your.vcenter.server", "Administrator@vmware.server", "P@ssw0rd", False) # False disable SSL check
print(client.list_folders()) # list folders in the root
vmfolder = client.list_folders()[0]
vms = client.list_vm(folders=[vmfolder]) # list vms
client.start_vm(vms[0]) # start vm
Code is under BSD3 license. See LICENSE file for details.