VMware vAPI Common Services Client Bindings
raw JSON → 2.61.2 verified Mon Apr 27 auth: no python maintenance
Python bindings for VMware vAPI Common Services, providing client libraries to interact with VMware Cloud Foundation (VCF) APIs. Current version 2.61.2 (older stable). The VCF SDK Python releases (up to 9.0.0.0) have replaced this package with the vcf-sdk-python namespace.
pip install vmware-vapi-common-client==2.61.2 Common errors
error ImportError: No module named vmware.vapi ↓
cause The vmware-vapi-common-client package is not installed or is installed but the import path is incorrect.
fix
Install with 'pip install vmware-vapi-common-client==2.61.2' and ensure import is 'from vmware.vapi.bindings.stub import StubConfiguration'.
error AttributeError: 'NoneType' object has no attribute 'security_context' ↓
cause StubConfiguration created without setting security_context, often due to missing authentication.
fix
Before using the stub config, set security_context: stub_config.security_context = create_user_security_context(username, password).
error TypeError: __init__() got an unexpected keyword argument 'security_context' ↓
cause Trying to pass security_context as a constructor argument to StubConfiguration, which is not supported.
fix
Create StubConfiguration first, then assign stub_config.security_context = create_user_security_context(...).
error ModuleNotFoundError: No module named 'vmware.vapi.client' ↓
cause Importing VapiClient from an incorrect submodule (vmware.vapi.client does not exist).
fix
Use 'from vmware.vapi.core import VapiClient'.
Warnings
deprecated This library is superseded by vcf-sdk-python (namespace vcf). New projects should use 'pip install vcf-sdk-python' and import from vcf.* ↓
fix Use 'pip install vcf-sdk-python' and update imports: from vcf.platform import Vcenter etc.
breaking Version 2.61.2 is the last PyPI release from the old vapi-common-client series. The new VCF SDK (9.0.0.0) changed module structure: StubConfiguration is now in vcf.bindings.stub. ↓
fix For VCF SDK 9+, install vcf-sdk-python and use: from vcf.bindings.stub import StubConfiguration.
gotcha Authentication via environment variables (VCF_USERNAME, VCF_PASSWORD) is required for most API calls. If not set, security_context is None and calls may fail with authentication errors. ↓
fix Always set VCF_USERNAME and VCF_PASSWORD before creating the client.
Imports
- StubConfiguration wrong
from vmware.vapi.common_client import StubConfigurationcorrectfrom vmware.vapi.bindings.stub import StubConfiguration - VapiClient wrong
from vmware.vapi.client import VapiClientcorrectfrom vmware.vapi.core import VapiClient
Quickstart
from vmware.vapi.bindings.stub import StubConfiguration
from vmware.vapi.core import VapiClient
from vmware.vapi.security.client_security import create_user_security_context
# Example of creating a StubConfiguration
stub_config = StubConfiguration()
# For authentication, use environment variables
username = os.environ.get('VCF_USERNAME', '')
password = os.environ.get('VCF_PASSWORD', '')
if username and password:
security_ctx = create_user_security_context(username, password)
stub_config.security_context = security_ctx
print("vAPI client configuration ready")