Skip to content

Commit e5a91d9

Browse files
authored
Merge branch 'master' into patch-2
2 parents eeadfe9 + 3e65c49 commit e5a91d9

File tree

7 files changed

+15
-10
lines changed

7 files changed

+15
-10
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 3.0.1
2+
current_version = 3.0.3
33
commit = True
44

55
[bumpversion:file:ibm_watson/version.py]

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,6 @@ To find out which authentication to use, view the service credentials. You find
9898

9999
On this page, you should be able to see your credentials for accessing your service instance.
100100

101-
![alt text](https://user-images.githubusercontent.com/13935994/55351058-6ac51900-548b-11e9-886e-945c6d4f31df.png)
102-
103-
104101
### Supplying credentials
105102

106103
There are two ways to supply the credentials you found above to the SDK for authentication.
@@ -137,12 +134,20 @@ If you'd prefer to set authentication values manually in your code, the SDK supp
137134

138135
### IAM
139136

140-
IBM Cloud is migrating to token-based Identity and Access Management (IAM) authentication. IAM authentication uses a service API key to get an access token that is passed with the call. Access tokens are valid for approximately one hour and must be regenerated.
137+
IBM Cloud has migrated to token-based Identity and Access Management (IAM) authentication. IAM authentication uses a service API key to get an access token that is passed with the call. Access tokens are valid for approximately one hour and must be regenerated.
141138

142139
You supply either an IAM service **API key** or an **access token**:
143140

144141
- Use the API key to have the SDK manage the lifecycle of the access token. The SDK requests an access token, ensures that the access token is valid, and refreshes it if necessary.
145142
- Use the access token if you want to manage the lifecycle yourself. For details, see [Authenticating with IAM tokens](https://console.bluemix.net/docs/services/watson/getting-started-iam.html).
143+
- Use a server-side to generate access tokens using your IAM API key for untrusted environments like client-side scripts. The generated access tokens will be valid for one hour and can be refreshed.
144+
145+
### Generating access tokens using IAM API key
146+
```python
147+
# In your API endpoint use this to generate new access tokens
148+
iam_token_manager = IAMTokenManager(iam_apikey='<apikey>')
149+
token = iam_token_manager.get_token()
150+
```
146151

147152
#### Supplying the IAM API key
148153

examples/visual_recognition_v3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# with open(abspath('resources/cars.zip'), 'rb') as cars, \
1717
# open(abspath('resources/trucks.zip'), 'rb') as trucks:
1818
# classifier = service.create_classifier('Cars vs Trucks',
19-
# positive_examples={'cars_positive_examples': cars},
19+
# positive_examples={'cars': cars},
2020
# negative_examples=trucks).get_result()
2121
# print(json.dumps(classifier, indent=2))
2222

ibm_watson/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '3.0.1'
1+
__version__ = '3.0.3'

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import os
2020
import sys
2121

22-
__version__ = '3.0.1'
22+
__version__ = '3.0.3'
2323

2424
if sys.argv[-1] == 'publish':
2525
# test server

test/integration/test_visual_recognition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def test_custom_classifier(self):
4242
open(abspath('resources/trucks.zip'), 'rb') as trucks:
4343
classifier = self.visual_recognition.create_classifier(
4444
'CarsVsTrucks',
45-
positive_examples={'cars_positive_examples': cars},
45+
positive_examples={'cars': cars},
4646
negative_examples=trucks,
4747
).get_result()
4848

test/unit/test_visual_recognition_v3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def test_create_classifier(self):
111111

112112
with open(os.path.join(os.path.dirname(__file__), '../../resources/cars.zip'), 'rb') as cars, \
113113
open(os.path.join(os.path.dirname(__file__), '../../resources/trucks.zip'), 'rb') as trucks:
114-
vr_service.create_classifier('Cars vs Trucks', positive_examples={'cars_positive_examples': cars}, negative_examples=trucks)
114+
vr_service.create_classifier('Cars vs Trucks', positive_examples={'cars': cars}, negative_examples=trucks)
115115

116116
assert len(responses.calls) == 2
117117

0 commit comments

Comments
 (0)