Vainu CLI Python API

When using Vainu APIs with Python you can make use of vainu_cli helpers from Vainu CLI.

PyPI

If you manage your own Python environment you can install vainu_cli from PyPI.

pip install vainu-cli (Or uv pip install vainu-cli / uv add vainu-cli)

Code Example - Async Exports Without the Polling Code

vainu_cli ships the polling, retry, and download logic for the async APIs, so you don't reimplement it.

import os

from vainu_cli import VainuOAuthAPIClient

# Get your credentials:
# https://developers.vainu.com/docs/client-credentials-authentication

client = VainuOAuthAPIClient(
    client_id=os.environ["VAINU_CLIENT_ID"],
    client_secret=os.environ["VAINU_CLIENT_SECRET"],
)

result = client.organizations_async(
    {
        "database": "FI",
        "query": {"?GTE": {"financial_data.revenue": 1_000_000}},
        "fields": ["business_id", "name"],
        "limit": 100,
    },
    format="csv",
)
# Uses curl if available for efficient downloading of file:
result.download_to_file("fi-plus_1M_revenue.csv")

Vainu CLI Source Code at GitHub

​https://github.com/vainu-app/vainu-cli/