Civis API Python Client

2.8.1 · active · verified Thu Apr 16

The Civis API Python Client provides a convenient way to interact with the Civis Platform API from Python. It allows users to manage data, jobs, scripts, and other resources within the platform. The current version is 2.8.1, and the library maintains an active release cadence with frequent minor updates and bug fixes.

Common errors

Warnings

Install

Imports

Quickstart

Initialize the API client. It's recommended to set your Civis API key as an environment variable (CIVIS_API_KEY). This example attempts to list containers to verify connectivity and authentication.

import os
from civis import APIClient

# Best practice: set CIVIS_API_KEY environment variable
# If not set, you can pass it directly: APIClient(api_key="YOUR_API_KEY")
client = APIClient(api_key=os.environ.get('CIVIS_API_KEY', ''))

# Example: List containers (requires appropriate permissions)
try:
    containers = client.containers.list()
    print(f"Successfully connected! Found {len(containers)} containers.")
except Exception as e:
    print(f"Error connecting to Civis Platform: {e}")
    print("Please ensure CIVIS_API_KEY is set correctly and has permissions.")

view raw JSON →