Code sample to demonstrate use of the new Nutanix v4 APIs via Python SDK.
- Python 3.6, 3.7 or 3.8 are officially supported
- Nutanix Prism Central 2023.3 or later
- Nutanix AOS 6.7 or later
-
Create and activate a Python virtual environment:
python -m venv venv . venv/bin/activate -
Install required packages:
pip install -r requirements.txt -
Run script e.g. list Prism Central images:
python list_images_sdk.py <prism_central_ip> <username>Note: User will be prompted for password
This repository provides two additional files. Using them is optional.
startup.example.json: Should be renamed tostartup.jsonand edited to contain details appropriate for your environment.startup.py: A script that can be used to initialise the Python REPL during testing. This script will import various Nutanix Python SDKS, instantiate the SDKs and create objects useful during testing. Note: This script is for testing only and contains very limited error checking and validation.
To use these optional files, continue below:
-
Create and activate Python virtual environment as per the steps above
-
Rename
startup.json.exampletostartup.json -
Edit
startup.jsonto contain values appropriate for your environment -
Initialise the Python REPL using
startup.py:python -i startup.py -
If the script returns no errors, initialisation was successful.