I'm trying to use the datarobot python API, and I'm setting the credentials in code as mentioned in the documentation, but I keep getting en error saying credentials are not found and they need to be setup in the environment variables. How do I use the credentials I set in `datarobot.Client()` in the rest of my code? My understanding is that it would create a global variable in the backend and all subsequent calls to the DataRobot library will use that?
Solved! Go to Solution.
Hi @azamrik ,
There are basically two options you have. Either you say
endpoint = 'https://app.eu.datarobot.com/api/v2/'
token = 'MY_TOKEN'
client = dr.Client(endpoint=endpoint, token=token)
Then all subsequent calls to datarobot, like dr.Project.start(...) will work with the credentials stored in your current python session. Please note I am using the European cloud environment here - please adjust to your endpoint.
The other option is to create a file under ~/.config/datarobot/drconfig.yaml with the following content:
"""
token: MY_TOKEN
endpoint: https://app.eu.datarobot.com/api/v2
"""
this will then be used by any call to datarobot implicitly, without the need to specify token and endpoint in each python session again.
Cheers,
Lukas
Hi @azamrik ,
There are basically two options you have. Either you say
endpoint = 'https://app.eu.datarobot.com/api/v2/'
token = 'MY_TOKEN'
client = dr.Client(endpoint=endpoint, token=token)
Then all subsequent calls to datarobot, like dr.Project.start(...) will work with the credentials stored in your current python session. Please note I am using the European cloud environment here - please adjust to your endpoint.
The other option is to create a file under ~/.config/datarobot/drconfig.yaml with the following content:
"""
token: MY_TOKEN
endpoint: https://app.eu.datarobot.com/api/v2
"""
this will then be used by any call to datarobot implicitly, without the need to specify token and endpoint in each python session again.
Cheers,
Lukas
Thanks, seems like not having a variable to contain the output from `dr.Client()` causes the issue.