3aa5e7f2896b2e03bdb749d139140505eaa537cd,speech/grpc/transcribe.py,,make_channel,#Any#Any#,29
Before Change
ssl_channel = implementations.ssl_channel_credentials(None, None, None)
// Grab application default credentials from the environment
creds = get_credentials().create_scoped([SPEECH_SCOPE])
// Add a plugin to inject the creds into the header
auth_header = (
"Authorization",
"Bearer " + creds.get_access_token().access_token)
auth_plugin = implementations.metadata_call_credentials(
lambda _, cb: cb([auth_header], None),
name="google_creds")
After Change
credentials, _ = google.auth.default(scopes=[SPEECH_SCOPE])
// Create a secure channel using the credentials.
http_request = google.auth.transport.requests.Request()
target = "{}:{}".format(host, port)
return google.auth.transport.grpc.secure_authorized_channel(
credentials, http_request, target)
def main(input_uri, encoding, sample_rate, language_code="en-US"):
service = cloud_speech_pb2.SpeechStub(
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 19
Instances
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 3aa5e7f2896b2e03bdb749d139140505eaa537cd
Time: 2016-12-15
Author: jonwayne@google.com
File Name: speech/grpc/transcribe.py
Class Name:
Method Name: make_channel
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 3aa5e7f2896b2e03bdb749d139140505eaa537cd
Time: 2016-12-15
Author: jonwayne@google.com
File Name: speech/grpc/transcribe_async.py
Class Name:
Method Name: make_channel
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 3aa5e7f2896b2e03bdb749d139140505eaa537cd
Time: 2016-12-15
Author: jonwayne@google.com
File Name: speech/grpc/transcribe_streaming.py
Class Name:
Method Name: make_channel