Skip to main content

Introduction

The Civis API Python client is a Python package that helps analysts and developers interact with the Civis Platform. The package includes a set of tools around common workflows as well as a convenient interface to make requests directly to the Civis API. See the full documentation for more details.

Installation

  1. Get a Civis API key (instructions).

  2. Add a CIVIS_API_KEY environment variable.

  3. You can add the following to .bash_profile for bash:

    export CIVIS_API_KEY="alphaNumericApiK3y"
  4. Source your .bash_profile

  5. Install the package:

    pip install civis
  6. Optionally, install pandas, and pubnub to enable some functionality in civis-python:

    pip install pandas
    pip install pubnub

    Installation of pandas will allow some functions to return DataFrame outputs. Installation of pubnub will improve performance in all functions which wait for a Civis Platform job to complete.

Usage

civis-python includes a number of wrappers around the Civis API for common workflows.

import civis
df = civis.io.read_civis(table="my_schema.my_table",
                         database="database",
                         use_pandas=True)

The Civis API may also be directly accessed via the APIClient class.

import civis
client = civis.APIClient()
database = client.databases.list()

See the full documentation for a more complete user guide.

Retries

The API client will automatically retry for certain API error responses.

If the error is one of [413, 429, 503] and the API client is told how long it needs to wait before it’s safe to retry (this is always the case with 429s, which are rate limit errors), then the client will wait the specified amount of time before retrying the request.

If the error is one of [429, 502, 503, 504] and the request is not a patch* or post* method, then the API client will retry the request several times, with a delay, to see if it will succeed.

Build Documentation Locally

To build the API documentation locally:

cd docs
make html

Then open docs/build/html/index.html.

Note that this will use your API key in the CIVIS_API_KEY environment variable so it will generate documentation for all the endpoints that you have access to.

Contributing

See CONTRIBUTING.md for information about contributing to this project.

License

BSD-3

See LICENSE.md for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

civis-1.8.1.tar.gz (176.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

civis-1.8.1-py3-none-any.whl (282.9 kB view details)

Uploaded Python 3

File details

Details for the file civis-1.8.1.tar.gz.

File metadata

  • Download URL: civis-1.8.1.tar.gz
  • Upload date:
  • Size: 176.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for civis-1.8.1.tar.gz
Algorithm Hash digest
SHA256 dd310ced2928f938b6f17ef12888228496018a4514978fd41c309d9915a02c82
MD5 41d2da0185fe5fc26100cbecf28e0cdb
BLAKE2b-256 0409b23feaa18e2a8dea947885cab20acc7b5ad7ccec3b2f0f7cf133520a2c6a

See more details on using hashes here.

File details

Details for the file civis-1.8.1-py3-none-any.whl.

File metadata

  • Download URL: civis-1.8.1-py3-none-any.whl
  • Upload date:
  • Size: 282.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/38.5.1 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.6.2

File hashes

Hashes for civis-1.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 879270312d8993d488a6ac4690ca4e7d2eb1c1043d8b86ea50618dd105742af0
MD5 24959d8ddc717a22b20f0b6199a414f3
BLAKE2b-256 a4c2ac3b537c873504f0ceb0684e1e307caa1f9ac5b29de2dd395431d3e16878

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page