Integrations

Python SDK

The official infinianalytics package wraps the InfiniAnalytics event API into simple method calls that never break your automation's control flow.

Installation

Install from PyPI using pip:

bash
pip install infinianalytics

Requires Python 3.7+. No external dependencies needed.

Initialization

Create an InfiniAnalytics instance once per execution, passing your organization token and the automation UUID you copied from the InfiniAnalytics dashboard:

python
from infinianalytics import InfiniAnalytics

execution = InfiniAnalytics(
    token="your_organization_token",
    automation_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
)

If you don't pass an execution_id, one is generated automatically from datetime.now().isoformat(). Pass your own if you need to correlate the execution with an ID from your own system.

Never hardcode your organization token in source code. Use an environment variable: token=os.environ["INFINI_TOKEN"].

Methods

Call these directly on the execution instance - there is no context manager or separate init step:

MethodWhen to use
.start(description)Registers the START event - call once at the beginning of the run.
.event(description)Registers an intermediate EVENT - call as many times as needed to log progress.
.warning(description)Registers a WARNING - a non-critical issue worth flagging without failing the run.
.end(description)Registers the END event - call once on successful completion.
.error(description, error_id=None, error_description=None)Registers an ERROR - marks the execution as failed. Call it from inside an except block.

Usage Example

python
from infinianalytics import InfiniAnalytics
import os

execution = InfiniAnalytics(
    token=os.environ["INFINI_TOKEN"],
    automation_id="your-uuid"
)

execution.start("Invoice processing started")

invoices = fetch_invoices()
execution.event(f"Fetched {len(invoices)} invoices")

for inv in invoices:
    process(inv)

execution.end(f"Processed {len(invoices)} invoices successfully")

Error Handling

Call .error() from inside an except block so every failure is registered:

python
execution.start("Processing started")
try:
    result = risky_operation()
    execution.end("Completed successfully")
except Exception as ex:
    execution.error(
        description="Validation failed",
        error_id="VALIDATION_ERROR",
        error_description=str(ex),
    )
    raise
The library never raises on its own. If a call to the InfiniAnalytics API fails (e.g. a network issue), the method prints a message and returns None instead of throwing - a broken connection to InfiniAnalytics will never break your automation.

PyPI Reference

The full package documentation and changelog are available on PyPI:

View on PyPI