# VMware vCenter Server
VMware vCenter Server library contains client bindings for VMware vCenter Server Automation APIs. This library is part of [vSphere Automation SDK for Python](https://github.com/vmware/vsphere-automation-sdk-python).
[Package (PyPI)](https://pypi.org/project/vmware-vcenter/) | [REST API documentation](https://developer.broadcom.com/xapis/vsphere-automation-api/latest/)
## Getting started
### Prerequisites
- Python 3.8+ is required to use this package.
### Install the package
```bash
pip install vmware-vcenter
```
### Connect to a vCenter Server
```python
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:
```shell
(venv) het-m03:vsphere-automation-sdk-python het$ python
Python 3.9.8 (main, Nov 10 2021, 06:03:50)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 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](http://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html)
Raw data
{
"_id": null,
"home_page": "https://github.com/vmware/vsphere-automation-sdk-python",
"name": "vmware-vcenter",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "Broadcom, VCF, vSphere, vCenter Server",
"author": "Broadcom",
"author_email": null,
"download_url": null,
"platform": null,
"description": "# VMware vCenter Server\n\nVMware vCenter Server library contains client bindings for VMware vCenter Server Automation APIs. This library is part of [vSphere Automation SDK for Python](https://github.com/vmware/vsphere-automation-sdk-python).\n\n[Package (PyPI)](https://pypi.org/project/vmware-vcenter/) | [REST API documentation](https://developer.broadcom.com/xapis/vsphere-automation-api/latest/)\n\n## Getting started\n\n### Prerequisites\n\n- Python 3.8+ is required to use this package.\n\n### Install the package\n\n```bash\npip install vmware-vcenter\n```\n\n### Connect to a vCenter Server\n\n```python\nimport requests\nimport urllib3\nfrom vmware.vapi.vsphere.client import create_vsphere_client\nsession = requests.session()\n\n# Disable cert verification for demo purpose.\n# This is not recommended in a production environment.\nsession.verify = False\n\n# Disable the secure connection warning for demo purpose.\n# This is not recommended in a production environment.\nurllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)\n\n# Connect to a vCenter Server using username and password\nvsphere_client = create_vsphere_client(server='<vc_ip>', username='<vc_username>', password='<vc_password>', session=session)\n\n# List all VMs inside the vCenter Server\nvsphere_client.vcenter.VM.list()\n```\n\nOutput in a Python Interpreter:\n\n```shell\n(venv) het-m03:vsphere-automation-sdk-python het$ python\nPython 3.9.8 (main, Nov 10 2021, 06:03:50)\n[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import requests\n>>> import urllib3\n>>> from vmware.vapi.vsphere.client import create_vsphere_client\n>>> session = requests.session()\n>>> session.verify = False\n>>> urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)\n>>> vsphere_client = create_vsphere_client(server='<vc_ip>', username='<vc_username>', password='<vc_password>', session=session)\n>>> vsphere_client.vcenter.VM.list()\n[Summary(vm='vm-58', name='standalone-20e4bd3af-esx.0-vm.0', power_state=State(string='POWERED_OFF'), cpu_count=1, memory_size_mib=256),\n...]\n```\n\n**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](http://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html)\n\n\n",
"bugtrack_url": null,
"license": "License :: OSI Approved :: MIT License",
"summary": "Client library for vSphere Automation APIs",
"version": "4.3.0",
"project_urls": {
"Homepage": "https://github.com/vmware/vsphere-automation-sdk-python"
},
"split_keywords": [
"broadcom",
" vcf",
" vsphere",
" vcenter server"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6dd990c7257eb4e07a006ae454b5c84712cc0b6425a646a05b147c7f4f6bcf83",
"md5": "72cba30dcbd714a93843b501825ac8fc",
"sha256": "198dded44838720f043a7e074f84209219f3c0bcc8b87b8e43f4a834c15b8daf"
},
"downloads": -1,
"filename": "vmware_vcenter-4.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "72cba30dcbd714a93843b501825ac8fc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 1347155,
"upload_time": "2024-07-01T09:37:10",
"upload_time_iso_8601": "2024-07-01T09:37:10.417565Z",
"url": "https://files.pythonhosted.org/packages/6d/d9/90c7257eb4e07a006ae454b5c84712cc0b6425a646a05b147c7f4f6bcf83/vmware_vcenter-4.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-01 09:37:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vmware",
"github_project": "vsphere-automation-sdk-python",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "vmware-vcenter"
}