Python SDK for VMware vCloud Director and vCloud Air.
This project is under development, the classes, methods and parameters might change over time. This README usually reflects the syntax of the latest version.
New vCD support is located under pyvcloud/vcd directory.
Import modules and instantiate a VCA object:
from pyvcloud.vcloudair import VCA
vcd = VCA(host, user, service_type, service_version, verify)
Login to a vCloud Director instance:
result = vcd.login(password=password, org=org)
See changes log for a list of changes.
The Python SDK requires the libxml2 and libxslt libraries, see lxml for more details.
On Debian/Ubuntu, you can install lxml and Python development dependencies with this command:
sudo apt-get install libxml2-dev libxslt-dev python-dev python-pip
On RHEL-based distributions:
sudo yum install libxslt-devel libxml2-devel python-devel python-pip
The Python SDK can then be installed with the following command:
pip install --user pyvcloud
pyvcloud can also be installed with virtualenv
See the examples directory for sample code.
To run the source code, check it out from GitHub and install it with:
python setup.py develop
To log the requests, add the log=True
parameter to the VCA constructor. The log is appended to file $TMPDIR/pyvcloud.log
.
vcd = VCA(host=host,
username=username,
service_type='vcd',
version='5.7',
verify=False,
log=True)
To test pyvcloud:
git clone https://github.com/vmware/pyvcloud.git
cd pyvcloud
virtualenv .venv
source .venv/bin/activate
python setup.py develop
pip install -r test-requirements.txt
cp tests/config.yaml my_config.yaml
# customize credentials and other parameters
nosetests --verbosity=2 --tc-format yaml --tc-file my_config.yaml tests/00010_vcd_login.py
See .gitlab-ci.yml for current tests.