Python SDK

The Deep 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.

Get set up to use the Python SDK

Prerequisites

  • Python version 3.4 or 3.7

    The Python executable must be in your system path. For Windows, in the Python installer, select Add Python 3.<x> 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 your Deep Security Manager.

  1. Download the Python SDK

    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 below commands assume that the Python executable is in your system path.

    Windows

    python -m pip install .

    Linux/Mac

    python3 -m pip install .

If the Deep Security Manager in your development environment uses the default self-signed certificate for establishing secure HTTP connections and you do not import the certificate, you cannot connect to the server. You can disable the requirement for an SSL certificate by adding the following line to your code: deepsecurity.Configuration.verify_ssl = False. You should only disable SSL verification in development environments. For production environments make sure that SSL verification is on.

Trend Micro Deep Security SDKs are distributed under the Apache 2.0 license.

Install a Python IDE

You can use any Python IDE to develop for the Deep Security API. If you need to install one, we recommend using PyCharm Community Edition. 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

Follow the procedure below to create a PyCharm project that can run the code examples in the Automation Center 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 Deep 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 Automation Center guides.

    You can add the code examples from any of the other Automation Center guides to the project you created above.