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.
Note that the Python SDK library is not supported for AWS Lambda due to the AWS Lambda's limitation described in Parallel Processing in Python with AWS Lambda.
Prepare to use the Python SDK
Prerequisites
-
Python version 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
- Download the SDK that is compatible with your Deep Security Manager.
-
Extract the Python SDK ZIP file.
-
Open a command line or terminal and change the current directory to the directory of the extracted contents.
-
Ensure that the Python executable is in your system path, and then enter the following command to install the module and dependencies:
Windows
shell
python -m pip install .
Linux or Mac
shell
python3 -m pip install .
If 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, ensure that SSL verification is enabled.
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 an IDE, Trend Micro recommends PyCharm Community Edition, because 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 guide you through the process of setting up the Eclipse IDE with the Python SDK:
- Preparing the IDE for Trend Micro Deep Security Automation
- Configuring the Trend Micro Deep Security Python SDK
Add the SDK to a project in PyCharm
You can create a PyCharm project to run the code examples in the Automation Center guides, as follows:
- Run PyCharm.
- Click Create New Project.
- In Location, change the folder to which you wish to save (if needed), and then enter a name for the project.
- Click Project Interpreter: New Virtualenv environment.
- Select Inherit global site-packages.
- Click Create.
Next steps
- For information on how to use the SDK with the Deep Security API, see Send our first request using the API.
- If you are already familiar with using an API or have specific tasks for which you want to use the SDK, see Run code examples in other Automation Center guides. You can add code examples from any of the other Automation Center guides to the project you created.