Configuration¶
Each authentication method will specify credentials for DataRobot, as well as the location of the DataRobot deployment. We currently support configuration using a configuration file, by setting environment variables, or within the code itself.
Credentials¶
You will have to specify an API token and an endpoint in order to use the client. You can manage your API tokens in the DataRobot webapp, in your profile. This section describes how to use these options. Their order of precedence is as follows, noting that the first available option will be used:
Setting endpoint and token in code using
datarobot.Client
Configuring from a config file as specified directly using
datarobot.Client
Configuring from a config file as specified by the environment variable
DATAROBOT_CONFIG_FILE
Configuring from the environment variables
DATAROBOT_ENDPOINT
andDATAROBOT_API_TOKEN
Searching for a config file in the home directory of the current user, at
~/.config/datarobot/drconfig.yaml
Note
If you access the DataRobot webapp at
https://app.datarobot.com
, then the correct endpoint to specify would be
https://app.datarobot.com/api/v2
. If you have a local installation, update the endpoint
accordingly to point at the installation of DataRobot available on your local network.
Set Credentials Explicitly in Code¶
Explicitly set credentials in code:
import datarobot as dr
dr.Client(token='your_token', endpoint='https://app.datarobot.com/api/v2')
You can also point to a YAML config file to use:
import datarobot as dr
dr.Client(config_path='/home/user/my_datarobot_config.yaml')
Use a Configuration File¶
You can use a configuration file to specify the client setup.
The following is an example configuration file that should be saved as ~/.config/datarobot/drconfig.yaml
:
token: yourtoken
endpoint: https://app.datarobot.com/api/v2
You can specify a different location for the DataRobot configuration file by setting
the DATAROBOT_CONFIG_FILE
environment variable. Note that if you specify a filepath, you should
use an absolute path so that the API client will work when run from any location.
Set Credentials Using Environment Variables¶
Set up an endpoint by setting environment variables in the UNIX shell:
export DATAROBOT_ENDPOINT='https://app.datarobot.com/api/v2'
export DATAROBOT_API_TOKEN=your_token