google.gax.config

Runtime configuration shared by gax modules.

Functions

create_stub(generated_create_stub[, ...]) Creates a gRPC client stub.
exc_to_code(exc) Retrieves the status code from an exception
API_ERRORS = (<class 'grpc.RpcError'>,)

Errors that indicate that an RPC was aborted.

NAME_STATUS_CODES = {<StatusCode.FAILED_PRECONDITION: (9, 'failed precondition')>: 'FAILED_PRECONDITION', <StatusCode.RESOURCE_EXHAUSTED: (8, 'resource exhausted')>: 'RESOURCE_EXHAUSTED', <StatusCode.OUT_OF_RANGE: (11, 'out of range')>: 'OUT_OF_RANGE', <StatusCode.CANCELLED: (1, 'cancelled')>: 'CANCELLED', <StatusCode.UNAVAILABLE: (14, 'unavailable')>: 'UNAVAILABLE', <StatusCode.UNKNOWN: (2, 'unknown')>: 'UNKNOWN', <StatusCode.DEADLINE_EXCEEDED: (4, 'deadline exceeded')>: 'DEADLINE_EXCEEDED', <StatusCode.UNAUTHENTICATED: (16, 'unauthenticated')>: 'UNAUTHENTICATED', <StatusCode.PERMISSION_DENIED: (7, 'permission denied')>: 'PERMISSION_DENIED', <StatusCode.INVALID_ARGUMENT: (3, 'invalid argument')>: 'INVALID_ARGUMENT', <StatusCode.INTERNAL: (13, 'internal')>: 'INTERNAL', <StatusCode.UNIMPLEMENTED: (12, 'unimplemented')>: 'UNIMPLEMENTED', <StatusCode.DATA_LOSS: (15, 'data loss')>: 'DATA_LOSS', <StatusCode.NOT_FOUND: (5, 'not found')>: 'NOT_FOUND', <StatusCode.ABORTED: (10, 'aborted')>: 'ABORTED'}

Inverse map for STATUS_CODE_NAMES

STATUS_CODE_NAMES = {'DATA_LOSS': <StatusCode.DATA_LOSS: (15, 'data loss')>, 'RESOURCE_EXHAUSTED': <StatusCode.RESOURCE_EXHAUSTED: (8, 'resource exhausted')>, 'OUT_OF_RANGE': <StatusCode.OUT_OF_RANGE: (11, 'out of range')>, 'CANCELLED': <StatusCode.CANCELLED: (1, 'cancelled')>, 'UNAVAILABLE': <StatusCode.UNAVAILABLE: (14, 'unavailable')>, 'UNKNOWN': <StatusCode.UNKNOWN: (2, 'unknown')>, 'UNIMPLEMENTED': <StatusCode.UNIMPLEMENTED: (12, 'unimplemented')>, 'UNAUTHENTICATED': <StatusCode.UNAUTHENTICATED: (16, 'unauthenticated')>, 'PERMISSION_DENIED': <StatusCode.PERMISSION_DENIED: (7, 'permission denied')>, 'INVALID_ARGUMENT': <StatusCode.INVALID_ARGUMENT: (3, 'invalid argument')>, 'INTERNAL': <StatusCode.INTERNAL: (13, 'internal')>, 'DEADLINE_EXCEEDED': <StatusCode.DEADLINE_EXCEEDED: (4, 'deadline exceeded')>, 'FAILED_PRECONDITION': <StatusCode.FAILED_PRECONDITION: (9, 'failed precondition')>, 'NOT_FOUND': <StatusCode.NOT_FOUND: (5, 'not found')>, 'ABORTED': <StatusCode.ABORTED: (10, 'aborted')>}

Maps strings used in client config to the status codes they represent.

This is necessary for google.gax.api_callable.construct_settings to translate the client constants configuration for retrying into the correct gRPC objects.

create_stub(generated_create_stub, channel=None, service_path=None, service_port=None, credentials=None, scopes=None, ssl_credentials=None)[source]

The function to use to create stubs.

exc_to_code(exc)[source]

A function that takes an exception and returns a status code.

May return None if the exception is not associated with a status code.