beta/test_utilities.py
Go to the documentation of this file.
1 # Copyright 2015 gRPC authors.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 """Test-appropriate entry points into the gRPC Python Beta API."""
15 
16 import grpc
17 from grpc.beta import implementations
18 
19 
20 def not_really_secure_channel(host, port, channel_credentials,
21  server_host_override):
22  """Creates an insecure Channel to a remote host.
23 
24  Args:
25  host: The name of the remote host to which to connect.
26  port: The port of the remote host to which to connect.
27  channel_credentials: The implementations.ChannelCredentials with which to
28  connect.
29  server_host_override: The target name used for SSL host name checking.
30 
31  Returns:
32  An implementations.Channel to the remote host through which RPCs may be
33  conducted.
34  """
35  target = '%s:%d' % (host, port)
36  channel = grpc.secure_channel(target, channel_credentials, ((
37  'grpc.ssl_target_name_override',
38  server_host_override,
39  ),))
40  return implementations.Channel(channel)
grpc.beta
Definition: src/python/grpcio/grpc/beta/__init__.py:1
tests.unit.beta.test_utilities.not_really_secure_channel
def not_really_secure_channel(host, port, channel_credentials, server_host_override)
Definition: beta/test_utilities.py:20
grpc.secure_channel
def secure_channel(target, credentials, options=None, compression=None)
Definition: src/python/grpcio/grpc/__init__.py:1982


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:32