TIPCommon.utils
The TIPCommon.utils module serves as a foundational toolkit for integration developers. It provides essential helpers for string manipulation, secure type casting, OData query construction, and environment-specific checks to ensure that integrations run smoothly across different platform versions and execution states.
Data cleaning and type casting
These functions handle the "pre-processing" of data, ensuring variables are in the correct format before being used in logic or sent to external APIs.
| Function | Parameters | Description & Returns |
|---|---|---|
camel_to_snake_case() |
|
Returns: str
Converts |
cast_keys_to_int() |
|
Returns: dict
Creates a new dictionary where all keys are cast to integers. Often used when processing JSON data that represents IDs as strings. |
clean_result() |
|
Returns: str
Strips leading and trailing whitespace. A svital utility for cleaning user input from integration parameters. |
none_to_default_value() |
|
Returns: Any
Checks if a value is |
safe_cast_bool_value_from_str() |
|
Returns: bool | Any
Converts string booleans (like "true") to actual booleans. Returns the
|
safe_cast_int_value_from_str() |
|
Returns: int | Any
Attempts to cast a value to an integer. Returns the |
Environment and execution logic
These utilities allow scripts to identify their runtime context, such as whether they are running as a test, an asynchronous action, or on a specific version of the platform.
| Function | Parameters | Description & Returns |
|---|---|---|
is_first_run() |
|
Returns: bool
Determines if an action is being executed asynchronously for the first time. Used to manage state in polling actions. |
is_test_run() |
|
Returns: bool
Identifies if the script is running in "Test" mode within the IDE. Use this to bypass real API calls during development. |
is_overflowed() |
|
Returns: bool
Checks if an alert meets the platform's overflow criteria. Essential for connectors to prevent redundant alert ingestion. |
is_python_37() |
None |
Returns: bool
Checks if the current Python version is at least 3.7. Useful for toggling between legacy and modern language features. |
platform_supports_1p_api() |
None |
Returns: bool
Checks if the instance supports First-Party (1P) unified APIs. Enables dynamic fallback logic for multi-platform support. |
platform_supports_db() |
|
Returns: bool
Determines if the environment supports DataStreams. If
|
Data validation and filtering
Utilities for ensuring data integrity, performing set operations, and retrieving values from complex JSON structures.
| Function | Parameters | Description & Returns |
|---|---|---|
escape_odata_literal() |
|
Returns: Any
Doubles single quotes in a string for OData compliance. |
get_unique_items_by_difference() |
|
Returns: list
Calculates the set difference (Pool - Remove) and returns unique items as a list. Useful for filtering processed alerts. |
get_value_from_json() |
|
Returns: Any
Retrieves values from nested JSON using a "waterfall" of keys. Returns
the |
is_empty_string_or_none() |
|
Returns: bool
Returns |
is_valid_email() |
|
Returns: bool
Validates an email address format using standard regular expression. Useful for pre-validating parameters before external API calls. |
is_valid_uuid() |
|
Returns: bool
Ensures a string is a valid UUID version 4. Prevents 400 errors when passing IDs to platform endpoints. |
System and file utilities
Helpers for interacting with the operating system, managing temporary files, and handling entity metadata.
| Function | Parameters | Description & Returns |
|---|---|---|
create_and_write_to_tempfile() |
|
Returns: Path
Writes content to a secure temporary file. Useful for actions that require passing data to command-line tools. |
get_entity_original_identifier() |
|
Returns: str
Retrieves the original identifier for an entity, ensuring accurate mapping back to source alerts. |
get_function_arg_names() |
|
Returns: list
Uses reflection to retrieve all argument names defined in a function. Essential for building dynamic wrappers. |
get_sdk_api_uri() |
|
Returns: str
Retrieves the base API URI for the current environment. Vital for constructing custom REST calls outside standard wrappers. |
safe_json_for_204() |
|
Returns: list | dict | Any
Safely handles 204 (No Content) responses. Returns an empty list or the
|
temporarily_remove_header() |
|
Returns: callable
Decorator: Temporarily removes a header (like
|