vCenter Python SDK
raw JSON → 9.0.0.0 verified Mon Apr 27 auth: no python
Client library for vCenter Automation APIs. Version 9.0.0.0 targets VMware Cloud Foundation 9.0. Provides Pythonic access to vCenter RESTful endpoints for managing inventory, VMs, datastores, and more.
pip install vmware-vcenter Common errors
error ModuleNotFoundError: No module named 'vmware_vcenter' ↓
cause Installing old package name or using wrong import path.
fix
Run: pip install vmware-vcenter and import: from vmware.vcenter import VcenterClient
error ValueError: Invalid server URL ↓
cause Missing https:// in server parameter.
fix
Prefix server with https:// e.g., server='https://vcenter.example.com'
error requests.exceptions.ConnectionError: HTTPSConnectionPool ... Max retries exceeded ↓
cause vCenter certificate is self-signed or not trusted.
fix
Set verify=False on client creation (not recommended for production) or provide CA bundle.
Warnings
breaking The package was renamed from 'vmware_vcenter' to 'vmware-vcenter' for PyPI, but import path uses dots: 'vmware.vcenter'. ↓
fix Use 'pip install vmware-vcenter' and import 'from vmware.vcenter import ...'
gotcha Authentication details are sensitive. Do not hardcode credentials in code; use environment variables or a secrets vault. ↓
fix Use os.environ.get('VCENTER_USERNAME'), os.environ.get('VCENTER_PASSWORD')
deprecated The old synchronous client pattern is deprecated; prefer async or session-based approach. ↓
fix Migrate to VcenterClient with session token management.
Imports
- VcenterClient wrong
from vmware_vcenter import VcenterClientcorrectfrom vmware.vcenter import VcenterClient
Quickstart
from vmware.vcenter import VcenterClient
client = VcenterClient(server='vcenter.example.com', username='admin', password='password')
# or use session
tokens = client.get_tokens()
print(client.vm.list())