You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+39-3Lines changed: 39 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,9 +90,45 @@ Watson services are migrating to token-based Identity and Access Management (IAM
90
90
### Getting credentials
91
91
To find out which authentication to use, view the service credentials. You find the service credentials for authentication the same way for all Watson services:
92
92
93
-
1. Go to the IBM Cloud [Dashboard](https://console.bluemix.net/dashboard/apps?category=ai) page.
94
-
1. Either click an existing Watson service instance or click [**Create resource > AI**](https://console.bluemix.net/catalog/?category=ai) and create a service instance.
95
-
1. Copy the `url` and either `apikey` or `username` and `password`. Click **Show** if the credentials are masked.
93
+
1. Go to the IBM Cloud [Dashboard](https://cloud.ibm.com/) page.
94
+
1. Either click an existing Watson service instance in your [resource list](https://cloud.ibm.com/resources) or click [**Create resource > AI**](https://cloud.ibm.com/catalog?category=ai) and create a service instance.
95
+
1. Click on the **Manage** item in the left nav bar of your service instance.
96
+
97
+
On this page, you should be able to see your credentials for accessing your service instance.
98
+
99
+
### Supplying credentials
100
+
101
+
There are two ways to supply the credentials you found above to the SDK for authentication.
102
+
103
+
#### Credential file (easier!)
104
+
105
+
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. You can get this file by clicking the **Download** button for the credentials in the **Manage** tab of your service instance.
106
+
107
+
The file downloaded will be called `ibm-credentials.env`. 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 SDK will look for your `ibm-credentials.env` file in the following places (in order):
108
+
109
+
- Your system's home directory
110
+
- The top-level directory of the project you're using the SDK in
111
+
112
+
As long as you set that up correctly, you don't have to worry about setting any authentication options in your code. So, for example, if you created and downloaded the credential file for your Discovery instance, you just need to do the following:
113
+
114
+
```python
115
+
discovery = DiscoveryV1(version='2018-08-01')
116
+
```
117
+
118
+
And that's it!
119
+
120
+
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.
121
+
122
+
If you would like to configure the location/name of your credential file, you can set an environment variable called `IBM_CREDENTIALS_FILE`. **This will take precedence over the locations specified above.** Here's how you can do that:
123
+
124
+
```bash
125
+
export IBM_CREDENTIALS_FILE="<path>"
126
+
```
127
+
128
+
where `<path>` is something like `/home/user/Downloads/<file_name>.env`.
129
+
130
+
#### Manually
131
+
If you'd prefer to set authentication values manually in your code, the SDK supports that as well. The way you'll do this depends on what type of credentials your service instance gives you.
assertstr(err.value) =='The URL shouldn\'t start or end with curly brackets or quotes. Be sure to remove any {} and \" characters surrounding your URL'
0 commit comments