pyarrow.flight.ServerMiddleware#

class pyarrow.flight.ServerMiddleware#

Bases: _Weakrefable

Server-side middleware for a call, instantiated per RPC.

Methods here should be fast and must be infallible: they should not raise exceptions or stall indefinitely.

__init__(*args, **kwargs)#

Methods

__init__(*args, **kwargs)

call_completed(self, exception)

A callback when the call finishes.

sending_headers(self)

A callback before headers are sent.

call_completed(self, exception)#

A callback when the call finishes.

Parameters:
exceptionpyarrow.ArrowException

If the call errored, this is the equivalent exception. Will be None if the call succeeded.

sending_headers(self)#

A callback before headers are sent.

Returns:
headersdict

A dictionary of header values to add to the response, or None if no headers are to be added. The dictionary should have string keys and string or list-of-string values.

Bytes values are allowed, but the underlying transport may not support them or may restrict them. For gRPC, binary values are only allowed on headers ending in “-bin”.

Header names must be lowercase ASCII.