btnexus-node-python.btStreamingNode module

A Node which accepts audio streams and forwards them to the speech to text service of your choice and publishes the transcript on the transcript topic

class btStreamingNode.StreamingNode(language=None, personalityId=None, sessionId=None, **kwargs)[source]

Bases: btNode.Node

Constructor sets up the NexusConnector.

Parameters
  • token (String) – AccessToken for the btNexus

  • axonURL (String) – URL for the Axon(InstanceURL)

  • debug (bool) – switch for debug messages

  • logger (Logger) – a logger object to log to

  • personalityId (String) – Id of your Personality

  • integrationId (String) – Id of the integration this Node belongs to

connect(**kwargs)[source]

connect the Axon and start the reactor for twisted. This will always block because of the reactor pattern

disconnectFromService()[source]

clean up the connection to the Service

disconnectService()[source]

This disconnects the service - to reconnect the service call reconnectService(). This will trigger onStreamReady again.

eatStream()[source]

This just eats all the bytes from the stream if it is not seekable.

getSessionId()[source]

return the sessionId this needs to be implemented for a service node

handshake()[source]

Do the Handshake with the Service and retry until it works.

onStreamReady()[source]

Start your stream with self.stream(stream) - this will stream data from the given stream to the SpeechService.

reconnectService()[source]

Reconnect to the service after a call to disconnectService - This will trigger onStreamReady.

setSessionId(response)[source]

callback for the sessionAccessRequest

stream(stream)[source]

This takes a stream and streams it to the Service

streamTo(host, port)[source]

This reacts to the message from the Service telling where to connect to with twisted.