Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.


Nutanix Developer Portal Code Samples - Python

To use the Python code samples, the following environment is recommended.

  • Python >=3.7 (3.7 or later ...)
  • Python requests (official documentation for requests) and urllib3 (official install for urllib3) libraries. This will need to be done before running the Python scripts.
  • The accompanying JSON files from this repository (instructions and usage provided below).
  • A suitable Python editor, e.g. Microsoft Visual Studio Code for GUI editing.
  • Access to a Nutanix Cluster for API testing purposes.
  • Nutanix Community Edition is supported but may not always provide the exact same APIs as a "full" Nutanix cluster.


Please note that instructions provided in this repository will assume the use of Visual Studio Code for GUI editing purposes. Otherwise ubiquitous editors such as vi can be used.

Python Script Usage

The provided Python scripts are designed to be standalone and can be run without additional dependencies beyond those provided above.

The examples and screenshots below are from the sample. This sample uses create_vm_v3_basic.json for the request parameters.

  1. Open Visual Studio Code.
  2. Create a new file, then copy and paste the code sample from this repository into the editor.
  3. Save the file with .py extension, e.g.
  4. Visual Studio Code will ask if you would like to install the 'Python' and 'Pylint' extensions - these is highly recommended.
  5. Create a new file, then copy and paste the contents of create_vm_v3_basic.json into the editor.
  6. Save the file with .json extension, e.g. create_vm_v3_basic.json.
  7. Edit the JSON values for cluster_ip, username and vm_name so that they match your environment & requirements. The script will prompt for the password when run.
  8. Within Visual Studio Code, click View > Command Palette and start typing Terminal. Select Python: Create Terminal when the option is shown.


Configuring Visual Studio Code for "real" debugging is beyond the scope of this readme. However, an extensive guide can be found at

  1. Important note before continuing: The Python 3.7 executable location will vary between Linux, OS X and Windows. Please run the executable for your operating system in the steps below.
  1. The script will prompt for your account password, then submit the request based on the script spec. An example based on is shown below, running on Ubuntu 19.04.

  2. Check the output to make sure the request has a state of PENDING.

You can’t perform that action at this time.