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.
pip install civisVerified import paths — ran on the pinned version, not inferred.
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.
Set `CIVIS_API_KEY` in your environment or use a secure secret management solution. Example: `export CIVIS_API_KEY='your_api_key'`
For DataFrame output, explicitly set `return_as="pandas"` or `return_as="polars"`: `df = civis.io.read_civis_sql(sql_query, database_id, return_as="pandas")`
Upgrade to `civis>=2.8.0` to use the `.json()` method on `PaginatedResponse` objects. Alternatively, on older versions, iterate through the response to access items.
Verify your `CIVIS_API_KEY` environment variable is correctly set and contains a valid Civis API key. Ensure the key has the necessary permissions for the API calls you are making.
Install the library using pip: `pip install civis`
Upgrade your `civis` library to version 2.8.0 or newer: `pip install --upgrade civis`. If unable to upgrade, you will need to process the paginated response by iterating over it rather than calling `.json()`.