Classes | Functions | Variables
grpc._simple_stubs Namespace Reference

Classes

class  ChannelCache
 

Functions

grpc.Channel _create_channel (str target, Sequence[Tuple[str, str]] options, Optional[grpc.ChannelCredentials] channel_credentials, Optional[grpc.Compression] compression)
 
Iterator[ResponseTypestream_stream (Iterator[RequestType] request_iterator, str target, str method, Optional[Callable[[Any], bytes]] request_serializer=None, Optional[Callable[[bytes], Any]] response_deserializer=None, Sequence[Tuple[AnyStr, AnyStr]] options=(), Optional[grpc.ChannelCredentials] channel_credentials=None, bool insecure=False, Optional[grpc.CallCredentials] call_credentials=None, Optional[grpc.Compression] compression=None, Optional[bool] wait_for_ready=None, Optional[float] timeout=_DEFAULT_TIMEOUT, Optional[Sequence[Tuple[str, Union[str, bytes]]]] metadata=None)
 
ResponseType stream_unary (Iterator[RequestType] request_iterator, str target, str method, Optional[Callable[[Any], bytes]] request_serializer=None, Optional[Callable[[bytes], Any]] response_deserializer=None, Sequence[Tuple[AnyStr, AnyStr]] options=(), Optional[grpc.ChannelCredentials] channel_credentials=None, bool insecure=False, Optional[grpc.CallCredentials] call_credentials=None, Optional[grpc.Compression] compression=None, Optional[bool] wait_for_ready=None, Optional[float] timeout=_DEFAULT_TIMEOUT, Optional[Sequence[Tuple[str, Union[str, bytes]]]] metadata=None)
 
Iterator[ResponseTypeunary_stream (RequestType request, str target, str method, Optional[Callable[[Any], bytes]] request_serializer=None, Optional[Callable[[bytes], Any]] response_deserializer=None, Sequence[Tuple[AnyStr, AnyStr]] options=(), Optional[grpc.ChannelCredentials] channel_credentials=None, bool insecure=False, Optional[grpc.CallCredentials] call_credentials=None, Optional[grpc.Compression] compression=None, Optional[bool] wait_for_ready=None, Optional[float] timeout=_DEFAULT_TIMEOUT, Optional[Sequence[Tuple[str, Union[str, bytes]]]] metadata=None)
 
ResponseType unary_unary (RequestType request, str target, str method, Optional[Callable[[Any], bytes]] request_serializer=None, Optional[Callable[[bytes], Any]] response_deserializer=None, Sequence[Tuple[AnyStr, AnyStr]] options=(), Optional[grpc.ChannelCredentials] channel_credentials=None, bool insecure=False, Optional[grpc.CallCredentials] call_credentials=None, Optional[grpc.Compression] compression=None, Optional[bool] wait_for_ready=None, Optional[float] timeout=_DEFAULT_TIMEOUT, Optional[Sequence[Tuple[str, Union[str, bytes]]]] metadata=None)
 

Variables

 _DEFAULT_TIMEOUT = float(os.environ[_DEFAULT_TIMEOUT_KEY])
 
string _DEFAULT_TIMEOUT_KEY = "GRPC_PYTHON_DEFAULT_TIMEOUT_SECONDS"
 
 _EVICTION_PERIOD
 
string _EVICTION_PERIOD_KEY = "GRPC_PYTHON_MANAGED_CHANNEL_EVICTION_SECONDS"
 
 _LOGGER = logging.getLogger(__name__)
 
 _MAXIMUM_CHANNELS = int(os.environ[_MAXIMUM_CHANNELS_KEY])
 
string _MAXIMUM_CHANNELS_KEY = "GRPC_PYTHON_MANAGED_CHANNEL_MAXIMUM"
 
 CacheKey
 
 OptionsType = Sequence[Tuple[str, str]]
 
 RequestType = TypeVar('RequestType')
 
 ResponseType = TypeVar('ResponseType')
 

Function Documentation

◆ _create_channel()

grpc.Channel grpc._simple_stubs._create_channel ( str  target,
Sequence[Tuple[str, str]]  options,
Optional[grpc.ChannelCredentials channel_credentials,
Optional[grpc.Compression compression 
)
private

Definition at line 60 of file _simple_stubs.py.

◆ stream_stream()

Iterator[ResponseType] grpc._simple_stubs.stream_stream ( Iterator[RequestType request_iterator,
str  target,
str  method,
Optional[Callable[[Any], bytes]]   request_serializer = None,
Optional[Callable[[bytes], Any]]   response_deserializer = None,
Sequence[Tuple[AnyStr, AnyStr]]   options = (),
Optional[grpc.ChannelCredentials]   channel_credentials = None,
bool   insecure = False,
Optional[grpc.CallCredentials]   call_credentials = None,
Optional[grpc.Compression]   compression = None,
Optional[bool]   wait_for_ready = None,
Optional[float]   timeout = _DEFAULT_TIMEOUT,
Optional[Sequence[Tuple[str, Union[str, bytes]]]]   metadata = None 
)
Invokes a stream-stream RPC without an explicitly specified channel.

THIS IS AN EXPERIMENTAL API.

This is backed by a per-process cache of channels. Channels are evicted
from the cache after a fixed period by a background. Channels will also be
evicted if more than a configured maximum accumulate.

The default eviction period is 10 minutes. One may set the environment
variable "GRPC_PYTHON_MANAGED_CHANNEL_EVICTION_SECONDS" to configure this.

The default maximum number of channels is 256. One may set the
environment variable "GRPC_PYTHON_MANAGED_CHANNEL_MAXIMUM" to configure
this.

Args:
  request_iterator: An iterator that yields request values for the RPC.
  target: The server address.
  method: The name of the RPC method.
  request_serializer: Optional :term:`serializer` for serializing the request
    message. Request goes unserialized in case None is passed.
  response_deserializer: Optional :term:`deserializer` for deserializing the response
    message. Response goes undeserialized in case None is passed.
  options: An optional list of key-value pairs (:term:`channel_arguments` in gRPC Core
    runtime) to configure the channel.
  channel_credentials: A credential applied to the whole channel, e.g. the
    return value of grpc.ssl_channel_credentials().
  call_credentials: A call credential applied to each call individually,
    e.g. the output of grpc.metadata_call_credentials() or
    grpc.access_token_call_credentials().
  insecure: If True, specifies channel_credentials as
    :term:`grpc.insecure_channel_credentials()`. This option is mutually
    exclusive with the `channel_credentials` option.
  compression: An optional value indicating the compression method to be
    used over the lifetime of the channel, e.g. grpc.Compression.Gzip.
  wait_for_ready: An optional flag indicating whether the RPC should fail
    immediately if the connection is not ready at the time the RPC is
    invoked, or if it should wait until the connection to the server
    becomes ready. When using this option, the user will likely also want
    to set a timeout. Defaults to True.
  timeout: An optional duration of time in seconds to allow for the RPC,
    after which an exception will be raised. If timeout is unspecified,
    defaults to a timeout controlled by the
    GRPC_PYTHON_DEFAULT_TIMEOUT_SECONDS environment variable. If that is
    unset, defaults to 60 seconds. Supply a value of None to indicate that
    no timeout should be enforced.
  metadata: Optional metadata to send to the server.

Returns:
  An iterator of responses.

Definition at line 410 of file _simple_stubs.py.

◆ stream_unary()

ResponseType grpc._simple_stubs.stream_unary ( Iterator[RequestType request_iterator,
str  target,
str  method,
Optional[Callable[[Any], bytes]]   request_serializer = None,
Optional[Callable[[bytes], Any]]   response_deserializer = None,
Sequence[Tuple[AnyStr, AnyStr]]   options = (),
Optional[grpc.ChannelCredentials]   channel_credentials = None,
bool   insecure = False,
Optional[grpc.CallCredentials]   call_credentials = None,
Optional[grpc.Compression]   compression = None,
Optional[bool]   wait_for_ready = None,
Optional[float]   timeout = _DEFAULT_TIMEOUT,
Optional[Sequence[Tuple[str, Union[str, bytes]]]]   metadata = None 
)
Invokes a stream-unary RPC without an explicitly specified channel.

THIS IS AN EXPERIMENTAL API.

This is backed by a per-process cache of channels. Channels are evicted
from the cache after a fixed period by a background. Channels will also be
evicted if more than a configured maximum accumulate.

The default eviction period is 10 minutes. One may set the environment
variable "GRPC_PYTHON_MANAGED_CHANNEL_EVICTION_SECONDS" to configure this.

The default maximum number of channels is 256. One may set the
environment variable "GRPC_PYTHON_MANAGED_CHANNEL_MAXIMUM" to configure
this.

Args:
  request_iterator: An iterator that yields request values for the RPC.
  target: The server address.
  method: The name of the RPC method.
  request_serializer: Optional :term:`serializer` for serializing the request
    message. Request goes unserialized in case None is passed.
  response_deserializer: Optional :term:`deserializer` for deserializing the response
    message. Response goes undeserialized in case None is passed.
  options: An optional list of key-value pairs (:term:`channel_arguments` in gRPC Core
    runtime) to configure the channel.
  channel_credentials: A credential applied to the whole channel, e.g. the
    return value of grpc.ssl_channel_credentials().
  call_credentials: A call credential applied to each call individually,
    e.g. the output of grpc.metadata_call_credentials() or
    grpc.access_token_call_credentials().
  insecure: If True, specifies channel_credentials as
    :term:`grpc.insecure_channel_credentials()`. This option is mutually
    exclusive with the `channel_credentials` option.
  compression: An optional value indicating the compression method to be
    used over the lifetime of the channel, e.g. grpc.Compression.Gzip.
  wait_for_ready: An optional flag indicating whether the RPC should fail
    immediately if the connection is not ready at the time the RPC is
    invoked, or if it should wait until the connection to the server
    becomes ready. When using this option, the user will likely also want
    to set a timeout. Defaults to True.
  timeout: An optional duration of time in seconds to allow for the RPC,
    after which an exception will be raised. If timeout is unspecified,
    defaults to a timeout controlled by the
    GRPC_PYTHON_DEFAULT_TIMEOUT_SECONDS environment variable. If that is
    unset, defaults to 60 seconds. Supply a value of None to indicate that
    no timeout should be enforced.
  metadata: Optional metadata to send to the server.

Returns:
  The response to the RPC.

Definition at line 330 of file _simple_stubs.py.

◆ unary_stream()

Iterator[ResponseType] grpc._simple_stubs.unary_stream ( RequestType  request,
str  target,
str  method,
Optional[Callable[[Any], bytes]]   request_serializer = None,
Optional[Callable[[bytes], Any]]   response_deserializer = None,
Sequence[Tuple[AnyStr, AnyStr]]   options = (),
Optional[grpc.ChannelCredentials]   channel_credentials = None,
bool   insecure = False,
Optional[grpc.CallCredentials]   call_credentials = None,
Optional[grpc.Compression]   compression = None,
Optional[bool]   wait_for_ready = None,
Optional[float]   timeout = _DEFAULT_TIMEOUT,
Optional[Sequence[Tuple[str, Union[str, bytes]]]]   metadata = None 
)
Invokes a unary-stream RPC without an explicitly specified channel.

THIS IS AN EXPERIMENTAL API.

This is backed by a per-process cache of channels. Channels are evicted
from the cache after a fixed period by a background. Channels will also be
evicted if more than a configured maximum accumulate.

The default eviction period is 10 minutes. One may set the environment
variable "GRPC_PYTHON_MANAGED_CHANNEL_EVICTION_SECONDS" to configure this.

The default maximum number of channels is 256. One may set the
environment variable "GRPC_PYTHON_MANAGED_CHANNEL_MAXIMUM" to configure
this.

Args:
  request: An iterator that yields request values for the RPC.
  target: The server address.
  method: The name of the RPC method.
  request_serializer: Optional :term:`serializer` for serializing the request
    message. Request goes unserialized in case None is passed.
  response_deserializer: Optional :term:`deserializer` for deserializing the response
    message. Response goes undeserialized in case None is passed.
  options: An optional list of key-value pairs (:term:`channel_arguments` in gRPC Core
    runtime) to configure the channel.
  channel_credentials: A credential applied to the whole channel, e.g. the
    return value of grpc.ssl_channel_credentials().
  insecure: If True, specifies channel_credentials as
    :term:`grpc.insecure_channel_credentials()`. This option is mutually
    exclusive with the `channel_credentials` option.
  call_credentials: A call credential applied to each call individually,
    e.g. the output of grpc.metadata_call_credentials() or
    grpc.access_token_call_credentials().
  compression: An optional value indicating the compression method to be
    used over the lifetime of the channel, e.g. grpc.Compression.Gzip.
  wait_for_ready: An optional flag indicating whether the RPC should fail
    immediately if the connection is not ready at the time the RPC is
    invoked, or if it should wait until the connection to the server
    becomes ready. When using this option, the user will likely also want
    to set a timeout. Defaults to True.
  timeout: An optional duration of time in seconds to allow for the RPC,
    after which an exception will be raised. If timeout is unspecified,
    defaults to a timeout controlled by the
    GRPC_PYTHON_DEFAULT_TIMEOUT_SECONDS environment variable. If that is
    unset, defaults to 60 seconds. Supply a value of None to indicate that
    no timeout should be enforced.
  metadata: Optional metadata to send to the server.

Returns:
  An iterator of responses.

Definition at line 250 of file _simple_stubs.py.

◆ unary_unary()

ResponseType grpc._simple_stubs.unary_unary ( RequestType  request,
str  target,
str  method,
Optional[Callable[[Any], bytes]]   request_serializer = None,
Optional[Callable[[bytes], Any]]   response_deserializer = None,
Sequence[Tuple[AnyStr, AnyStr]]   options = (),
Optional[grpc.ChannelCredentials]   channel_credentials = None,
bool   insecure = False,
Optional[grpc.CallCredentials]   call_credentials = None,
Optional[grpc.Compression]   compression = None,
Optional[bool]   wait_for_ready = None,
Optional[float]   timeout = _DEFAULT_TIMEOUT,
Optional[Sequence[Tuple[str, Union[str, bytes]]]]   metadata = None 
)
Invokes a unary-unary RPC without an explicitly specified channel.

THIS IS AN EXPERIMENTAL API.

This is backed by a per-process cache of channels. Channels are evicted
from the cache after a fixed period by a background. Channels will also be
evicted if more than a configured maximum accumulate.

The default eviction period is 10 minutes. One may set the environment
variable "GRPC_PYTHON_MANAGED_CHANNEL_EVICTION_SECONDS" to configure this.

The default maximum number of channels is 256. One may set the
environment variable "GRPC_PYTHON_MANAGED_CHANNEL_MAXIMUM" to configure
this.

Args:
  request: An iterator that yields request values for the RPC.
  target: The server address.
  method: The name of the RPC method.
  request_serializer: Optional :term:`serializer` for serializing the request
    message. Request goes unserialized in case None is passed.
  response_deserializer: Optional :term:`deserializer` for deserializing the response
    message. Response goes undeserialized in case None is passed.
  options: An optional list of key-value pairs (:term:`channel_arguments` in gRPC Core
    runtime) to configure the channel.
  channel_credentials: A credential applied to the whole channel, e.g. the
    return value of grpc.ssl_channel_credentials() or
    grpc.insecure_channel_credentials().
  insecure: If True, specifies channel_credentials as
    :term:`grpc.insecure_channel_credentials()`. This option is mutually
    exclusive with the `channel_credentials` option.
  call_credentials: A call credential applied to each call individually,
    e.g. the output of grpc.metadata_call_credentials() or
    grpc.access_token_call_credentials().
  compression: An optional value indicating the compression method to be
    used over the lifetime of the channel, e.g. grpc.Compression.Gzip.
  wait_for_ready: An optional flag indicating whether the RPC should fail
    immediately if the connection is not ready at the time the RPC is
    invoked, or if it should wait until the connection to the server
    becomes ready. When using this option, the user will likely also want
    to set a timeout. Defaults to True.
  timeout: An optional duration of time in seconds to allow for the RPC,
    after which an exception will be raised. If timeout is unspecified,
    defaults to a timeout controlled by the
    GRPC_PYTHON_DEFAULT_TIMEOUT_SECONDS environment variable. If that is
    unset, defaults to 60 seconds. Supply a value of None to indicate that
    no timeout should be enforced.
  metadata: Optional metadata to send to the server.

Returns:
  The response to the RPC.

Definition at line 169 of file _simple_stubs.py.

Variable Documentation

◆ _DEFAULT_TIMEOUT

float grpc._simple_stubs._DEFAULT_TIMEOUT = float(os.environ[_DEFAULT_TIMEOUT_KEY])
private

Definition at line 54 of file _simple_stubs.py.

◆ _DEFAULT_TIMEOUT_KEY

string grpc._simple_stubs._DEFAULT_TIMEOUT_KEY = "GRPC_PYTHON_DEFAULT_TIMEOUT_SECONDS"
private

Definition at line 52 of file _simple_stubs.py.

◆ _EVICTION_PERIOD

grpc._simple_stubs._EVICTION_PERIOD
private
Initial value:
1 = datetime.timedelta(
2  seconds=float(os.environ[_EVICTION_PERIOD_KEY]))

Definition at line 38 of file _simple_stubs.py.

◆ _EVICTION_PERIOD_KEY

string grpc._simple_stubs._EVICTION_PERIOD_KEY = "GRPC_PYTHON_MANAGED_CHANNEL_EVICTION_SECONDS"
private

Definition at line 36 of file _simple_stubs.py.

◆ _LOGGER

grpc._simple_stubs._LOGGER = logging.getLogger(__name__)
private

Definition at line 34 of file _simple_stubs.py.

◆ _MAXIMUM_CHANNELS

int grpc._simple_stubs._MAXIMUM_CHANNELS = int(os.environ[_MAXIMUM_CHANNELS_KEY])
private

Definition at line 47 of file _simple_stubs.py.

◆ _MAXIMUM_CHANNELS_KEY

string grpc._simple_stubs._MAXIMUM_CHANNELS_KEY = "GRPC_PYTHON_MANAGED_CHANNEL_MAXIMUM"
private

Definition at line 45 of file _simple_stubs.py.

◆ CacheKey

grpc._simple_stubs.CacheKey
Initial value:
1 = Tuple[str, OptionsType, Optional[grpc.ChannelCredentials],
2  Optional[grpc.Compression]]

Definition at line 31 of file _simple_stubs.py.

◆ OptionsType

grpc._simple_stubs.OptionsType = Sequence[Tuple[str, str]]

Definition at line 30 of file _simple_stubs.py.

◆ RequestType

grpc._simple_stubs.RequestType = TypeVar('RequestType')

Definition at line 27 of file _simple_stubs.py.

◆ ResponseType

grpc._simple_stubs.ResponseType = TypeVar('ResponseType')

Definition at line 28 of file _simple_stubs.py.

grpc::ChannelCredentials
Definition: include/grpcpp/security/credentials.h:75
grpc.Compression
Definition: src/python/grpcio/grpc/__init__.py:2084


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