Skip to content

Commit 30d5c42

Browse files
authored
Merge pull request #670 from watson-developer-cloud/icp4d
Release 3.1.0 with ICP4D support
2 parents 9e83821 + b4d1166 commit 30d5c42

27 files changed

+9580
-4770
lines changed

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# lint Python modules using external checkers.
22
[MASTER]
33
ignore=SVN
4-
disable=R0903,R0912,R0913,R0914,R0915,W0141,C0111,C0103,W0603,W0703,R0911,C0301,C0302,R0902,R0904,W0142,W0212,E1101,E1103,R0201,W0201,W0122,W0232,RP0001,RP0003,RP0101,RP0002,RP0401,RP0701,RP0801,F0401,E0611,R0801,I0011,F0401,E0611,E1004,C0111,I0011,I0012,W0704,W0142,W0212,W0232,W0613,W0702,R0201,W0614,R0914,R0912,R0915,R0913,R0904,R0801,C0301,C0411,R0204,W0622,E1121,inconsistent-return-statements
4+
disable=R0903,R0912,R0913,R0914,R0915,W0141,C0111,C0103,W0603,W0703,R0911,C0301,C0302,R0902,R0904,W0142,W0212,E1101,E1103,R0201,W0201,W0122,W0232,RP0001,RP0003,RP0101,RP0002,RP0401,RP0701,RP0801,F0401,E0611,R0801,I0011,F0401,E0611,E1004,C0111,I0011,I0012,W0704,W0142,W0212,W0232,W0613,W0702,R0201,W0614,R0914,R0912,R0915,R0913,R0904,R0801,C0301,C0411,R0204,W0622,E1121,inconsistent-return-statements,R0205,C0325

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Python client library to quickly get started with the various [Watson APIs][wdc]
2727
* [Disable SSL certificate verification](#disable-ssl-certificate-verification)
2828
* [Sending request headers](#sending-request-headers)
2929
* [Parsing HTTP response info](#parsing-http-response-info)
30+
* [Using Websockets](#using-websockets)
31+
* [IBM Cloud Pak for Data(ICP4D)](#ibm-cloud-pak-for-data(icp4d))
3032
* [Dependencies](#dependencies)
3133
* [License](#license)
3234
* [Contributing](#contributing)
@@ -322,14 +324,41 @@ service.synthesize_using_websocket('I like to pet dogs',
322324
)
323325
```
324326

327+
## IBM Cloud Pak for Data(ICP4D)
328+
If your service instance is of ICP4D, below are two ways of initializing the assistant service.
329+
330+
#### 1) Supplying the `username`, `password`, `icp4d_url` and `authentication_type`
331+
The SDK will manage the token for the user
332+
```python
333+
assistant = AssistantV1(
334+
version='<version',
335+
username='<your username>',
336+
password='<your password>',
337+
url='<service url>', # should be of the form https://{icp_cluster_host}/{deployment}/assistant/{instance-id}/api
338+
icp4d_url='<authentication url>', # should be of the form https://{icp_cluster_host}
339+
authentication_type='icp4d')
340+
341+
assistant.disable_SSL_verification() # MAKE SURE SSL VERIFICATION IS DISABLED
342+
```
343+
344+
#### 2) Supplying the access token
345+
```python
346+
assistant = AssistantV1(
347+
version='<version>',
348+
url='service url', # should be of the form https://{icp_cluster_host}/{deployment}/assistant/{instance-id}/api
349+
icp4d_access_token='<your managed access token>')
350+
351+
assistant.disable_SSL_verification() # MAKE SURE SSL VERIFICATION IS DISABLED
352+
```
353+
325354
## Dependencies
326355

327356
* [requests]
328357
* `python_dateutil` >= 2.5.3
329358
* [responses] for testing
330359
* Following for web sockets support in speech to text
331360
* `websocket-client` 0.48.0
332-
* `ibm_cloud_sdk_core` >=0.2.0
361+
* `ibm_cloud_sdk_core` >=0.5.0
333362

334363
## Contributing
335364

examples/language_translator_v3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from ibm_watson import LanguageTranslatorV3
55

66
language_translator = LanguageTranslatorV3(
7-
version='2018-05-01.',
7+
version='2018-05-01',
88
### url is optional, and defaults to the URL below. Use the correct URL for your region.
99
# url='https://gateway.watsonplatform.net/language-translator/api',
1010
iam_apikey='YOUR APIKEY')

examples/microphone-speech-to-text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def pyaudio_callback(in_data, frame_count, time_info, status):
122122
pass
123123
except KeyboardInterrupt:
124124
# stop recording
125-
audio_source.completed_recording()
126125
stream.stop_stream()
127126
stream.close()
128127
audio.terminate()
128+
audio_source.completed_recording()

0 commit comments

Comments
 (0)