in tts/src/tts/amazonpolly.py [0:0]
def _dispatch(self, request):
"""Amazon Polly supports a number of APIs. This will call the right one based on the content of request.
Currently "SynthesizeSpeech" is the only recognized action. Basically this method just delegates the work
to ``self._synthesize_speech_and_save`` and returns the result as is. It will simply raise if a different
action is passed in.
:param request: an instance of PollyRequest
:return: whatever returned by the delegate
"""
actions = {
'SynthesizeSpeech': self._synthesize_speech_and_save
# ... more actions could go in here ...
}
if request.polly_action not in actions:
raise RuntimeError('bad or unsupported Amazon Polly action: "' + request.polly_action + '".')
return actions[request.polly_action](request)