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
* doc(IAM): Document changes for IAM support
* Add support for IAM (#456)
* Feat(IAM): Adding IAM feature
* Update constructors for IAM support (#459)
* :feat(iam): Generate service constructors to support IAM
* fix(vr): Fix vr tests (#463)
* fix(vr): Fix vr tests
* chore(discovery): Update test for discovery
* Regenerate discovery (#464)
* new(discovery): Generate discovery
* chore(discovery): Hand edits to discovery
* test(discovery): Add test for delete_user_data
* Regenerate language translator (#465)
* new(language-translator): Generate language translator
* Chore(lt): Hand edits to language translator and formatting
* Regenerate Tone Analyzer (#468)
* new(ta): Generate tone analyzer
* chore(ta): Hand edits and formatting for tone analyzer
* Regenerate conversation (#469)
* new(convresation): Generate conversation
* chore(conversation): Hand edits for conversation
* test(conversation): Add test for delete_user_data
* Regenerate Assistant (#470)
* new(assistant): Generate assistant
* chore(assistant): Hand edits and formatting
* test(assistant): Add test for delete_user_data
* chore(assistant): Add newline
* Regenerate Text to Speech (#471)
* new(tts): Generate tts
* chore(tts): Hand edits and pylint complaints for tts
* Regenerate natural language understanding (#466)
* new(nlu): Generate natural language understanding
* chore(nlu): hand edits for nlu
* Regenerate Visual recognition (#473)
* new(vr): Genetate visual recognition
* chore(cr): Hand edits for visual recognition
* Regenerate Persoanlity Insights (#467)
* new(personality insights): Generate personality insights
* chore(pi): hand edits for personality insights
* chore(pi): Hand edits remove profile_as_csv
* Regenerate Speech to text (#472)
* new(stt): Generate stt
* chore(stt): Hand edits for speech to text
* chore(stt): Pylint
* chore(deprecated): Use proper deprecation message
* test(discovery): Update the discovery test (#474)
* chore(pylint): Handle pylint issues (#476)
* :docs(IAM): Update readme with IAM examples (#478)
* :docs(IAM): Update readme with IAM examples
* Adding <code> around the method
* chore(readme): Update readme with IAM examples
* Generated changes for python 1.3.5 (#480)
* new(generator): Direct generator + formatting
* new(codegen): generated sdk changes + formatting
* new(codegen): generator + formatting
* fix(manual): Handedits for all services
* doc(readme): support set_iam_api_key
* fix(readme): remove VR auth from readme
Copy file name to clipboardExpand all lines: README.md
+66-1Lines changed: 66 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,15 +59,80 @@ To create an instance of the service:
59
59
1. Type a unique name for the service instance in the **Service name** field. For example, type `my-service-name`. Leave the default values for the other options.
60
60
1. Click **Create**.
61
61
62
+
## Authentication
62
63
To get your service credentials:
63
64
64
65
Copy your credentials from the **Manage** page. To find the Service details page for an existing service, navigate to your [IBM Cloud][ibm_cloud] dashboard and click the service name.
65
66
66
67
1. On the **Manage** page, you will see a **Credentials** pane
67
68
1. Depending on the service you will see use either:
68
-
* 2.a: `username`, `password`, and `url`(optional).
69
+
* 2.a: `username`, `password`, and `url`(optional) or `apikey`(for Visual Recognition).
69
70
* 2.b: `apikey` which is the value for parameter `iam_api_key` when initializing the constructor.
*Important: Instantiation with API key works only with Visual Recognition service instances created before May 23, 2018. Visual Recognition instances created after May 22 use IAM.*
87
+
88
+
```python
89
+
from watson_developer_cloud import VisualRecognitionV3
When authenticating with IAM, you have the option of passing in:
103
+
104
+
* the IAM API key and, optionally, the IAM service URL
105
+
* an IAM access token
106
+
107
+
**Be aware that passing in an access token means that you're assuming responsibility for maintaining that token's lifecycle.** If you instead pass in an IAM API key, the SDK will manage it for you.
108
+
109
+
```python
110
+
# In the constructor, letting the SDK manage the IAM token
111
+
discovery = DiscoveryV1(version='2017-10-16',
112
+
iam_api_key='<iam_api_key>',
113
+
iam_url='<iam_url>') # optional - the default value is https://iam.ng.bluemix.net/identity/token
114
+
```
115
+
116
+
```python
117
+
# after instantiation, letting the SDK manage the IAM token
118
+
discovery = DiscoveryV1(version='2017-10-16')
119
+
discovery.set_iam_api_key('<iam_api_key>')
120
+
```
121
+
122
+
```python
123
+
# in the constructor, assuming control of managing IAM token
124
+
discovery = DiscoveryV1(version='2017-10-16',
125
+
iam_access_token='<iam_access_token>')
126
+
```
127
+
128
+
```python
129
+
# after instantiation, assuming control of managing IAM token
130
+
discovery = DiscoveryV1(version='2017-10-16')
131
+
discovery.set_iam_access_token('<access_token>')
132
+
```
133
+
134
+
If at any time you would like to let the SDK take over managing your IAM token, simply override your stored IAM credentials with an IAM API key by calling the `set_token_manager()` method again.
0 commit comments