Pure Storage Python Toolkit Intro with Windows

Most of my scripting work here at Pure Storage has mostly been via PowerShell or at times Javascript (for like vRO). But I think it is time to get back into Python especially because of the VMware support for it now.

Pure Storage has an automation toolkit that helps get you started managing the FlashArray so you don’t have to deal with the direct REST work in your Python scripts. You can find information about that here:


First off, my friend and coworker Barkz has posted a similar post concerning this here and here. We did it slightly differently, so I figured this was still worth putting down. His both uses shell/bash interfaces in Windows, while I am just using the standard Windows Python install. I’m probably more of a fan of his methods, but this method is a bit simpler if you just want to get your feet wet quickly.

So first, install the latest version of Python for Windows, you can get that here.

Pretty simple install. Then open a Windows command prompt.

We need to install the Pure Storage module, which is pretty easy as PIP is built into this version of Python. So cd into  C:\Python27\Scripts or where ever you installed Python and run the following:

pip.exe install purestorage

You should see it successfully install, only takes a few seconds.


To verify the module and version you can run:

pip.exe freeze


The nice thing about this, is that you do not need to directly download anything, it will grab it off the net automatically.

Now launch the Python CLI tool.


Import the purestorage module with the following command:

import purestorage

Now you can run Pure Storage commands! Instantiate an array like so:

array = purestorage.FlashArray("csg-fa420-1.purecloud.local", "pureuser", "pureuser")

If you see an error like below, you need to fix your certificate problems, or you can have it ignore cert errors.certwarning

So you need to import requests and then disable these warnings so you don’t see them anymore:

import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning


Try the array connect command again and it will create an array object and connect to the FlashArray to create an authenticated session. Now you can run commands, like creating a volume etc:

array.create_volume("newpythonvol", "8G")



Stay tuned for more.

One thought on “Pure Storage Python Toolkit Intro with Windows”

Leave a Reply

Your email address will not be published. Required fields are marked *