Skip to main content

Client library for vmware-vcenter APIs

Project description

VMware vCenter Server

The vCenter module of the VMware Cloud Foundation SDK provides methods related to content libraries and resource deployment, tagging, and managing internal and external security certificates.

Package (PyPI) | REST API documentation

Getting started

Prerequisites

  • Supported Python versions: 3.10, 3.11, 3.12, 3.13 and 3.14

Install the package

pip install vmware-vcenter

Connect to a vCenter Server

import requests
import urllib3
from vmware.vapi.vsphere.client import create_vsphere_client
session = requests.session()

# Disable cert verification for demo purpose.
# This is not recommended in a production environment.
session.verify = False

# Disable the secure connection warning for demo purpose.
# This is not recommended in a production environment.
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

# Connect to a vCenter Server using username and password
vsphere_client = create_vsphere_client(server='<vc_ip>', username='<vc_username>', password='<vc_password>', session=session)

# List all VMs inside the vCenter Server
vsphere_client.vcenter.VM.list()

Output in a Python Interpreter:

>>> 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(server='<vc_ip>', username='<vc_username>', password='<vc_password>', session=session)
>>> vsphere_client.vcenter.VM.list()
[Summary(vm='vm-58', name='standalone-20e4bd3af-esx.0-vm.0', power_state=State(string='POWERED_OFF'), cpu_count=1, memory_size_mib=256),
...]

NOTE: If you are using Bash, be sure to use single quote for username and password to preserve the values. If you use double quote, you will have to escape special characters, such as "$". See Bash manual

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vmware_vcenter-9.1.0.0-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file vmware_vcenter-9.1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for vmware_vcenter-9.1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0be971614719d67e21a9dd597e20300db25ba79b45eabc66e74c8431ed3dcc21
MD5 de1859e1459dfd347c8395c3f4b8050c
BLAKE2b-256 ed3617bdce86362986b8b26a30984296076da627e5e1fe5d813e29485cc82c8d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page