examples(tts): Update text to speech examples
@@ -4,18 +4,13 @@ import json
from os.path import join, dirname
from ibm_watson import TextToSpeechV1
from ibm_watson.websocket import SynthesizeCallback
+from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
-# If service instance provides API key authentication
+authenticator = IAMAuthenticator('your_api_key')
service = TextToSpeechV1(
## url is optional, and defaults to the URL below. Use the correct URL for your region.
url='https://stream.watsonplatform.net/text-to-speech/api',
- iam_apikey='YOUR APIKEY')
-
-# service = TextToSpeechV1(
-# ## url is optional, and defaults to the URL below. Use the correct URL for your region.
-# # url='https://stream.watsonplatform.net/text-to-speech/api,
-# username='YOUR SERVICE USERNAME',
-# password='YOUR SERVICE PASSWORD')
+ authenticator=authenticator)
voices = service.list_voices().get_result()
print(json.dumps(voices, indent=2))
