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.
-
Get a Civis API key (instructions)
-
Add a
CIVIS_API_KEY
environment variable. -
You can add the following to
.bash_profile
for bashexport CIVIS_API_KEY="alphaNumericApiK3y"
-
Source your
.bash_profile
-
Install the package
pip install civis
-
Optionally, install
pandas
,pubnub
, andrequests-toolbelt
to enable some functionality incivis-python
pip install pandas pip install pubnub pip install requests-toolbelt
Installation of
pandas
will allow some functions to returnDataFrame
outputs. Installation ofpubnub
will improve performance in all functions which wait for a Civis Platform job to complete. Installation ofrequests-toolbelt
will allow streaming file uploads to Civis viacivis.io.file_to_civis
.
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.
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.
See CONTIBUTING.md
for information about contributing to this project.
BSD-3
See LICENSE.md
for details.