Beispiel #1
0
def getTtsToken():
    if (TTS_APIKEY):
        iamTokenManager = IAMTokenManager(iam_apikey=TTS_APIKEY)
        token = iamTokenManager.get_token()
    else:
        authorization = Authorization(username=TTS_USERNAME,
                                      password=TTS_PASSWORD)
        token = authorization.get_token(url=TTS_URL)
    return token
def getSttToken():
    try:
        data = request.form.get('data')
        authorization = Authorization(username=speachtotextUser,
                                      password=speachtotextPassword)
        retvalue = authorization.get_token(url=SpeechToText.default_url)
    except Exception as e:
        print(e)
    return retvalue
def getTtsToken():
    try:
        data = request.form.get('data')
        authorization = Authorization(username=texttospeachUser,
                                      password=texttospeachPassword)
        retvalue = authorization.get_token(url=TextToSpeech.default_url)
    except Exception as e:
        print(e)
    return retvalue
Beispiel #4
0
def get_token(request):
    """
    Request watson service to get token for streaming service
    """
    username = os.environ.get('username')
    password = os.environ.get('password')

    authorization = Authorization(username=username, password=password)

    return HttpResponse(authorization.get_token(url=SpeechToText.default_url),
                        content_type='text/plain')
Beispiel #5
0
def getSttToken():
    authorization = Authorization(
        username='******',
        password='******')
    return authorization.get_token(url=SpeechToText.default_url)
def getTtsToken():
	authorization = Authorization(username=TTS_USERNAME, password=TTS_PASSWORD)
	return authorization.get_token(url=TextToSpeech.default_url)
def getSttToken():
	print(STT_USERNAME)
	authorization = Authorization(username=STT_USERNAME, password=STT_PASSWORD)
	return authorization.get_token(url=SpeechToText.default_url)
Beispiel #8
0
import json
from watson_developer_cloud import AuthorizationV1 as Authorization
from watson_developer_cloud import SpeechToTextV1 as SpeechToText

authorization = Authorization(username='******',
                              password='******')

print(json.dumps(authorization.get_token(url=SpeechToText.default_url), indent=2))
Beispiel #9
0
 def obtain_auth_token(self):
     STT_USERNAME = os.environ['STT_USERNAME'] # '<Speech to Text username>'
     STT_PASSWORD = os.environ['STT_PASSWORD'] # '<Speech to Text password>'
     authorization = Authorization(username=STT_USERNAME, password=STT_PASSWORD)
     return authorization.get_token(url=SpeechToText.default_url)