Client for Purity//FB REST API (1.0 - 1.8), developed by Pure Storage, Inc. Documentations can be found at purity-fb.readthedocs.io.

This Python package is automatically generated by the Swagger Codegen project:

  • API version: 1.8
  • Package version: 1.8.0
  • Build package: io.swagger.codegen.languages.PythonClientCodegen For more information, please visit http://www.purestorage.com


Python 2.7 and 3.4+

Installation & Usage

pip install

There are two ways to use pip to install.

The first is the easiest, i.e., using pypi:

pip install purity_fb

The second is to install from Github:

pip install git+https://github.com/purestorage/purity_fb_python_client.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/purestorage/purity_fb_python_client.git)

Then import the package:

import purity_fb 


Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import purity_fb

Getting Started

Please follow the installation procedure and then run the following:

from purity_fb import PurityFb, FileSystem, FileSystemSnapshot, SnapshotSuffix, rest

# create PurityFb object for a certain array
fb = PurityFb("")
# this is required for versions before Purity//FB 2.1.3 because they only supports self-signed
# certificates. in later versions, this may be unnecessary if you have imported a certificate.

    ## manage file systems
    fs_obj = FileSystem(name="myfs", provisioned=50000)
    # create a file system named myfs
    # list all existing file systems
    # destroy the file system myfs
    fb.file_systems.update_file_systems(name="myfs", attributes=FileSystem(destroyed=True))
    # eradicate the file system myfs

    ## manage file system snapshots
    fb.file_system_snapshots.create_file_system_snapshots(sources=["myfs"], suffix=SnapshotSuffix("mysnap"))
    # destroy the file system snapshot myfs.mysnap
    fb.file_system_snapshots.update_file_system_snapshots(name="myfs.mysnap", attributes=FileSystemSnapshot(destroyed=True))
    # eradicate the file system snapshot myfs.mysnap

except rest.ApiException as e:
    print("Exception: %s\n" % e)

Documentation for PurityFb

A PurityFb object represents a FlashBlade device.

class purity_fb.PurityFb(host, version=None, api_token=None)


The argument host is required, which is the IP address or host name of the device.


The optional argument version is the REST version number that the client wants to target at. If absent, the latest version is chosen.


The optional argument api_token will be used to log into the array if specified.


Following are generic methods for all versions.

Method Parameters Description
disable_verify_ssl none Disable certificate verification for SSL. This method must be executed before any other calls.
list_versions none List all available REST versions of the array. Public, authentication not required.
login api_token Login to the REST server with a specified api-token. This method must be executed successfully before making any function calls to any APIs.
logout n/a Logout from the REST server

Note: Purity//FB 2.2 and later versions do support configuring certificates for REST server. However, when a certificate is not configured, a user is required to call disable_verify_ssl before making any other function calls. Once SSL verification is disabled, there will be warnings like the following:

/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3-1.20-py3.6.egg/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings

These warnings could be disabled using urllib3.disable_warnings.

Endpoint Properties

Once login succeeds, different endpoints could be accessed through the following read-only properties of PurityFb objects.

Non-version Endpoints

First, there are general endpoints that are not specific to versions, including api_version and authentication.

Property Type Descripstion
api_version VersionApi Public APIs for querying supported REST versions.
authentication AuthenticationApi Login/logout APIs.

Versioned Endpoints

Second, there are versioned endpoints that are secured by authentication and could be different from version to version. One can specify the version parameter when creating a PurityFb object to choose APIs for a specific REST version. If version is not specified, by default, the most recent REST version available on the server is chosen.

Call with HTTP information

Every method of each endpoint returns an object representing the body of the response from the server. If other information such as response status code or response header is needed, the corresponding method XXX_with_http_info() can be used.

For example,

fb = purity_fb.PurityFb("")
data = fb.file_systems.create_file_systems(FileSystem(name="myfs"))

Here response_data has type FileSystemResponse. And if call with HTTP information, both the response status and header will be returned as well.

(data, status, header) = fb.file_systems.create_file_systems_with_http_info(FileSystem(name="myfs"))

Request Timeout Configuration

Global Request Timeout

The property PurityFb.request_timeout allows one to get or update the global request timeout used by default for all API calls. The default request_timeout is 10 seconds for connection, and 30 seconds for read.

Property Type Descripstion
request_timeout urllib3.Timeout Set or get the global request timeout for accessing the device.

For example, fb.request_timeout = urllib3.Timeout(connect=8.0, read=20.0). This updates all API call to have 8 seconds connection timeout and 20 seconds read timeout by default.

One-time-only Request Timeout

All APIs support the keyword parameter _request_timeout (of type urllib3.Timeout ) to specify request timeout for a specific API call.

For example,

fb.file_systems.create_file_systems(FileSystem(name="myfs"), _request_timeout=urllib3.Timeout(connect=5.0, read=15.0))}}


The property PurityFb.request_retry allows one to get or update the global retry setting used by default for all API calls. The default request_retry is 5 retries per call.

Property Type Descripstion
request_retry urllib3.Retry Set or get the global request timeout for accessing the device.

For example, fb.request_retry = urllib3.Retry(total=20, connect=15, read=15). This updates all API call to have at most 20 retries in total, among which at most 15 connection retries and at most 15 read retries.

Documentation For Models

Documentation For Authorization


  • Type: API key
  • API key parameter name: api-token
  • Location: URL query string


  • Type: API key
  • API key parameter name: x-auth-token
  • Location: HTTP header


Pure Storage Inc.