module documentation

Request helper used by generated clients.

This module implements Request which encapsulates a single RPC invocation, including retries, authorization handling, metadata extraction and convenience synchronous wrappers. The Request object is created by a generated client and then awaited to perform the RPC. It is intentionally rich: it exposes request status metadata (initial/trailing metadata, request/trace ids), synchronous helpers (wait, initial_metadata_sync) and configurable retry/timeout behaviour.

Key concepts:

  • Authorization loop: when an authorization provider exists, the request will perform an auth step before attempting the RPC and will re-authenticate on UNAUTHENTICATED responses when allowed.
  • Retry loop: transient errors are retried according to configured retry counts and per-retry timeouts.

Only small, non-behavioral changes should be made to this module because the Request logic is central to the SDK call semantics.

Class Request Encapsulates an RPC invocation with retries and auth handling.
Exception RequestError Base exception for errors raised while processing a request.
Exception RequestIsCancelledError Exception raised when a request is cancelled.
Exception RequestIsSentError Exception raised when a request is already sent.
Exception RequestSentNoCallError Exception raised when a request is sent without a call.
Constant DEFAULT_AUTH_TIMEOUT Default timeout including the authorization and the request itself.
Constant DEFAULT_PER_RETRY_TIMEOUT Default per-retry timeout for requests.
Constant DEFAULT_TIMEOUT Default timeout for requests not including authorization.
Type Variable Err Error type variable. Either a protobuf/message or a custom wrapper.
Type Variable Req Request type variable. Either a protobuf/message or a serializable payload.
Type Variable Res Response type variable. Either a protobuf/message or a custom wrapper.
Type Variable T Undocumented
Variable log Undocumented
DEFAULT_AUTH_TIMEOUT = (source)

Default timeout including the authorization and the request itself.

Value
15 * 60.0
DEFAULT_PER_RETRY_TIMEOUT = (source)

Default per-retry timeout for requests.

Value
DEFAULT_TIMEOUT / 3
DEFAULT_TIMEOUT: float = (source)

Default timeout for requests not including authorization.

Value
60.0

Error type variable. Either a protobuf/message or a custom wrapper.

Value
TypeVar('Err')

Request type variable. Either a protobuf/message or a serializable payload.

Value
TypeVar('Req')

Response type variable. Either a protobuf/message or a custom wrapper.

Value
TypeVar('Res')

Undocumented

Value
TypeVar('T')

Undocumented