Python Example of Creating a
vSphere Automation
Session with Username and Password

This example illustrates how to create an authenticated session to the
vSphere Automation
API by using basic authentication in Python.
import requests import urllib3 from vmware.vapi.vsphere.client import create_vsphere_client session = requests.session() session.verify = False urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) vsphere_client = create_vsphere_client(hostname, username, password, session=session) # Interface factory object: stub_config = vsphere_client._stub_config