![]() ![]() For example, using your favourite terminal, you can set environment variables for Assistant service instance: export ASSISTANT_APIKEY = "" export ASSISTANT_AUTH_TYPE = "iam" Simply set the environment variables using _ syntax. Where is something like /home/user/Downloads/.env. Here's how you can do that: export IBM_CREDENTIALS_FILE = "" This will take precedence over the locations specified above. If you would like to configure the location/name of your credential file, you can set an environment variable called IBM_CREDENTIALS_FILE. If you're using more than one service at a time in your code and get two different ibm-credentials.env files, just put the contents together in one ibm-credentials.env file and the SDK will handle assigning credentials to their appropriate services. So, for example, if you created and downloaded the credential file for your Discovery instance, you just need to do the following: discovery = DiscoveryV1 ( version = '' ) The top-level directory of the project you're using the SDK inĪs long as you set that up correctly, you don't have to worry about setting any authentication options in your code.The SDK will look for your ibm-credentials.env file in the following places (in order): This is the name the SDK will search for and must be preserved unless you want to configure the file path (more on that later). The file downloaded will be called ibm-credentials.env. You can get this file by clicking the Download button for the credentials in the Manage tab of your service instance. With a credential file, you just need to put the file in the right place and the SDK will do the work of parsing and authenticating. There are three ways to supply the credentials you found above to the SDK for authentication. On this page, you should be able to see your credentials for accessing your service instance. Click on the Manage item in the left nav bar of your service instance.Either click an existing Watson service instance in your resource list or click Create resource > AI and create a service instance.You find the service credentials for authentication the same way for all Watson services: To find out which authentication to use, view the service credentials. ![]() In other instances, you authenticate by providing the username and password for the service instance.With some service instances, you authenticate to the API by using IAM.Watson services are migrating to token-based Identity and Access Management (IAM) authentication. If you run your app in IBM Cloud, the SDK gets credentials from the environment variable. The examples within each service assume that you already have service credentials. The folder has basic and advanced examples. To install, use pip or easy_install: pip install -upgrade ibm-watsonĪ) Versions prior to 3.0.0 can be installed using: pip install -upgrade watson-developer-cloudī) If you run into permission issues try: sudo -H pip install -ignore-installed six ibm-watsonĬ) In case you run into problems installing the SDK in DSX, try !pip install -upgrade pip Python client library to quickly get started with the various services. ![]()
0 Comments
Leave a Reply. |