Python Script for API Task package
- Updated: 2026/06/03
The Python Script for API Task package enables users to import and execute Python scripts using API Tasks. This package leverages the Python library support within API Tasks to implement complex data processing, mathematical computations and machine learning capabilities using API Tasks.
Overview
The Python Script for API Task package contains actions that executes Python scripts or a specific function within the script. The workflow sequence for executing Python script is as follows:
- Define the source Python script and session name using the Open action.
- Execute the script using one of the following actions:
- Execute function: Use when executing a specific function within the script.
- Execute script: Use when executing the entire script.
- Close the Python Script session using the Close action.
The Python Script for API Task package supports Python script files as a data source. The Open action has file streaming capability, allowing you to select a Python script file using the Variable or Control Room file option. When you run the API Task, the Open action streams the file directly from the source and passes it to the downstream actions. The file stream capability enables you to stream the file directly from storage locations such as Google Drive, Microsoft 365 OneDrive, Salesforce, ServiceNow, or a REST API URI.
The package utilizes the Wasmer Python library integrated into the API Task runtime. The following Python libraries are supported:
| Libraries | Note |
|---|---|
|
Fully supported. |
|
Both libraries require WASM wheels to be installed on the local machine. |
|
Both libraries require WASIX to be installed and networking enabled on the local machine. |
|
lxml requires WASM to be installed on the local machine. |
|
aiohttp requires WASIX to be installed on the local machine. |
|
Fully supported. |
Actions in Python Script for API Task package
The following actions are available in this package
| Action | Description |
|---|---|
| Open |
The Open action defines the source Python and creates a session for executing Python scripts |
| Execute function |
The Execute function action executes a specific function within the Python script defined in the Open action. For an example, see Example of using Python script to join a list. |
| Execute script |
The Execute script action executes the Python script defined in the Open action. For an example, see Create a PDF using Python script. |
| Close |
The Close action closes the session. See Close action. |