InsionInsion
Python

Configuration and async usage

Configure the Python client and use it with asyncio

token is required. The synchronous client accepts base_url, environment, headers, timeout, max_retries, follow_redirects, and a custom httpx.Client.

from insion import InsionApi

client = InsionApi(
    token="<token>",
    base_url="https://api.insion.co",
    timeout=30.0,
    max_retries=2,
    headers={"X-Request-ID": "request-123"},
)

The default timeout is 60 seconds and the default retry limit is 2. Pass request_options={"timeout": 10.0, "max_retries": 0} to override either setting for one method call.

Async client

from insion import AsyncInsionApi

client = AsyncInsionApi(token="<token>")
result = await client.moderate_a_record(
    client_id="post-123", name="A post", entity="post", content="Hello world"
)

AsyncInsionApi has the same method names and arguments as InsionApi, but every method must be awaited. It also accepts an async_token callable and a custom httpx.AsyncClient.

On this page