Skip to content

Instantly share code, notes, and snippets.

@kbridbur
Created August 16, 2019 02:23
Show Gist options
  • Save kbridbur/4ee919348be86df87caf82d61d4379fd to your computer and use it in GitHub Desktop.
Save kbridbur/4ee919348be86df87caf82d61d4379fd to your computer and use it in GitHub Desktop.
Rev.ai Python Streaming Example
from rev_ai.models import MediaConfig
from rev_ai.streamingclient import RevAiStreamingClient
import io
config = MediaConfig(YOUR MEDIA CONTENT TYPE)
streamclient = RevAiStreamingClient(YOUR ACCESS TOKEN, config)
with io.open(YOUR FILE, 'rb') as stream:
MEDIA_GENERATOR = [stream.read()]
response_generator = streamclient.start(MEDIA_GENERATOR)
for response in response_generator:
print(response)
streamclient.end()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment