Public API Python client

The public API Python client makes it easy to write client programs for the DSS REST API in Python.

For usage samples, please see below.

Introduction

The public API Python client is in the dataikuapi Python package.

Installing the Python client

The public API Python client is preinstalled in DSS. If you plan on using it from within DSS (in a recipe, notebook, macro, scenario, ...), you don’t need to do anything specific.

To use the Python client from outside DSS, simply install it from pip.

pip install dataiku-api-client

This installs the client in the system-wide Python installation, so if you are not using virtualenv, you may need to replace pip by sudo pip.

Note that this will always install the latest version of the API client. You might need to request a version compatible with your version of DSS.

Getting started

To work with the API, a connection needs to be established with DSS, by creating a DSSClient object. Once the connection is established, the DSSClient object serves as the entry point to the other calls.

From inside DSS

The Python client can be used from inside DSS. In that case, you don’t need to provide any API key, as the API client will automatically inherit connection credentials from the current context

import dataiku

client = dataiku.api_client()

# client is now a DSSClient and can perform all authorized actions.
# For example, list the project keys for which you have access
client.list_project_keys()

From outside DSS

When connecting from the outside world, you need an API key. See Public API Keys for more information on how to create an API key and the associated privileges.

You also need to connect using the base URL of your DSS instance.

import dataikuapi

host = "http://localhost:11200"
apiKey = "some_key"
client = dataikuapi.DSSClient(host, apiKey)

# client is now a DSSClient and can perform all authorized actions.
# For example, list the project keys for which the API key has access
client.list_project_keys()