Table of contents

Python SDK

The Workload Security Python SDK consists of a package containing the module that you can use to interact with the API. If you would rather use the API directly via tools such as Postman and curl, you do not need an SDK.

Prepare to use the Python SDK

Prerequisites

  • Python version 3.9 or 3.11.

    The Python executable must be in your system path. For Windows, in the Python installer, select Add Python 3. to PATH at the start of the installation. For Linux, Python is added to the system path during Python installation.

  • pip package manager

    For Windows, pip is installed with Python. For Linux, pip is installed separately from Python. You can install pip using the package manager of your Linux distribution.

Download and install the Python SDK

Make sure that you download the SDK that is compatible with Workload Security.

  1. Download SDK.
  2. Extract the Python SDK ZIP file.
  3. Open a Command Line or Terminal and change the current directory to the directory of the extracted contents.
  4. Enter the following command to install the module and dependencies:

    The following commands assume that the Python executable is in your system path.

    Windows

    python -m pip install .

    Linux/Mac

    python3 -m pip install .

Install a Python IDE

You can use any Python IDE to develop for the Workload Security API. If you need to install one, you should use PyCharm Community Edition, as it is free, well-supported, and has a comprehensive feature set.

Windows

Download PyCharm Community Edition.

Linux

Follow the PyCharm installation instructions for your Linux distribution.

If you prefer to use Eclipse, the following videos step you through the process of setting up the Eclipse IDE with the Python SDK:

Add the SDK to a project in PyCharm

Perform the following steps to create a PyCharm project that can run the code examples in the Workload Security automation guides:

  1. Run PyCharm.
  2. Click Create New Project.
  3. In Location, change the folder you wish to save to if needed and then enter a name for the project.
  4. Click Project Interpreter: New Virtualenv environment.
  5. Select Inherit global site-packages.
  6. Click Create.

Next Steps

  • To get familiar with how to use the SDK with the Workload Security API, see the Send Your First Request Using the API guide.
  • If you are already familiar with using an API or have specific tasks that you want to use the SDK for, see Run the Code Examples to get started with the task-based examples in other Workload Security automation guides.

    You can add the code examples from any of the other Workload Security automation guides to the project you created above.