pyarrow.flight.ClientMiddleware¶
- class pyarrow.flight.ClientMiddleware¶
Bases:
_Weakrefable
Client-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.
received_headers
(self, headers)A callback when headers are received.
sending_headers
(self)A callback before headers are sent.
- call_completed(self, exception)¶
A callback when the call finishes.
The default implementation does nothing.
- Parameters:
- exception
ArrowException
If the call errored, this is the equivalent exception. Will be None if the call succeeded.
- exception
- received_headers(self, headers)¶
A callback when headers are received.
The default implementation does nothing.
- Parameters:
- headers
dict
A dictionary of headers from the server. Keys are strings and values are lists of strings (for text headers) or bytes (for binary headers).
- headers
- sending_headers(self)¶
A callback before headers are sent.
- Returns:
- headers
dict
A dictionary of header values to add to the request, 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.
- headers