h2 API reference
57 public APIs from h2 (python-hyper/h2) — 18 classes, 1 functions, 38 methods. Signatures extracted by static analysis of the actual source.
Repository: python-hyper/h2
| Kind | Count |
|---|---|
| Classes | 18 |
| Functions | 1 |
| Methods | 38 |
API list
class
src.h2._typing.BufferAn object implementing the PEP 688 buffer protocol.
method
src.h2.config.DummyLogger.debug(*vargs, **kwargs) -> NoneNo-op logging.
method
src.h2.config.DummyLogger.trace(*vargs, **kwargs) -> NoneNo-op logging.
class
src.h2.connection.H2ConnectionA low-level HTTP/2 connection object.
method
src.h2.connection.H2Connection.close_connection(error_code:ErrorCodes | int=0, additional_data:bytes | None=None, last_stream_id:int | None=None) -> NoneClose a connection, emitting a GOAWAY frame.
method
src.h2.connection.H2Connection.data_to_send(amount:int | None=None) -> bytesReturns some data for sending out of the internal data buffer.
method
src.h2.connection.H2Connection.end_stream(stream_id:int) -> NoneCleanly end a given stream.
method
src.h2.connection.H2Connection.open_inbound_streams() -> intThe current number of open inbound streams.
method
src.h2.connection.H2Connection.open_outbound_streams() -> intThe current number of open outbound streams.
method
src.h2.connection.H2Connection.ping(opaque_data:bytes | str) -> NoneSend a PING frame.
method
src.h2.connection.H2Connection.prioritize(stream_id:int, weight:int | None=None, depends_on:int | None=None, exclusive:bool | None=None) -> NoneNotify a server about the priority of a stream.
method
src.h2.connection.H2Connection.receive_data(data:Buffer) -> list[Event]Pass some received HTTP/2 data to the connection for handling.
method
src.h2.connection.H2Connection.reset_stream(stream_id:int, error_code:ErrorCodes | int=0) -> NoneReset a stream.
method
src.h2.connection.H2Connection.send_data(stream_id:int, data:bytes | memoryview, end_stream:bool=False, pad_length:Any=None) -> NoneSend data on a given stream.
method
src.h2.connection.H2Connection.update_settings(new_settings:dict[SettingCodes | int, int]) -> NoneUpdate the local settings.
class
src.h2.connection.H2ConnectionStateMachineA single HTTP/2 connection state machine.
method
src.h2.connection.H2ConnectionStateMachine.process_input(input_:ConnectionInputs) -> list[Event]Process a specific input in the state machine.
class
src.h2.errors.ErrorCodesAll known HTTP/2 error codes.
class
src.h2.events.EventBase class for h2 events.
class
src.h2.events.PingReceivedThe PingReceived event is fired whenever a PING is received.
class
src.h2.events.StreamResetThe StreamReset event is fired in two situations.
class
src.h2.exceptions.FlowControlErrorAn attempted action violates flow control constraints.
class
src.h2.exceptions.FrameDataMissingErrorThe frame that we received is missing some data.
class
src.h2.exceptions.H2ErrorThe base class for all exceptions for the HTTP/2 module.
class
src.h2.exceptions.InvalidSettingsValueErrorAn attempt was made to set an invalid Settings value.
class
src.h2.exceptions.NoAvailableStreamIDErrorThere are no available stream IDs left to the connection.
class
src.h2.exceptions.ProtocolErrorAn action was attempted in violation of the HTTP/2 protocol.
class
src.h2.settings.SettingCodesAll known HTTP/2 setting codes.
class
src.h2.settings.SettingsAn object that encapsulates HTTP/2 settings state.
class
src.h2.stream.H2StreamA low-level HTTP/2 stream object.
method
src.h2.stream.H2Stream.advertise_alternative_service(field_value:bytes) -> list[Frame]Advertise an RFC 7838 alternative service.
method
src.h2.stream.H2Stream.closed() -> boolWhether the stream is closed.
method
src.h2.stream.H2Stream.end_stream() -> list[Frame]End a stream without sending data.
method
src.h2.stream.H2Stream.locally_pushed() -> list[Frame]Mark this stream as one that was pushed by this peer.
method
src.h2.stream.H2Stream.receive_alt_svc(frame:AltSvcFrame) -> tuple[list[Frame], list[Event]]An Alternative Service frame was received on the stream.
method
src.h2.stream.H2Stream.receive_continuation() -> NoneA naked CONTINUATION frame has been received.
method
src.h2.stream.H2Stream.receive_data(data:bytes, end_stream:bool, flow_control_len:int) -> tuple[list[Frame], list[Event]]Receive some data.
method
src.h2.stream.H2Stream.receive_headers(headers:Iterable[Header], end_stream:bool, header_encoding:bool | str | None) -> tuple[list[Frame], list[Event]]Receive a set of headers (or trailers).
method
src.h2.stream.H2Stream.receive_window_update(increment:int) -> tuple[list[Frame], list[Event]]Handle a WINDOW_UPDATE increment.
method
src.h2.stream.H2Stream.reset_stream(error_code:ErrorCodes | int=0) -> list[Frame]Close the stream locally.
method
src.h2.stream.H2Stream.send_data(data:bytes | memoryview, end_stream:bool=False, pad_length:int | None=None) -> list[Frame]Prepare some data frames.
method
src.h2.stream.H2Stream.stream_reset(frame:RstStreamFrame) -> tuple[list[Frame], list[Event]]Handle a stream being reset remotely.
class
src.h2.stream.H2StreamStateMachineA single HTTP/2 stream state machine.
method
src.h2.stream.H2StreamStateMachine.data_received(previous_state:StreamState) -> list[Event]Fires when data is received.
method
src.h2.stream.H2StreamStateMachine.process_input(input_:StreamInputs) -> list[Event]Process a specific input in the state machine.
method
src.h2.stream.H2StreamStateMachine.recv_alt_svc(previous_state:StreamState) -> list[Event]Called when receiving an ALTSVC frame.
method
src.h2.stream.H2StreamStateMachine.request_received(previous_state:StreamState) -> list[Event]Fires when a request is received.
method
src.h2.stream.H2StreamStateMachine.request_sent(previous_state:StreamState) -> list[Event]Fires when a request is sent.
method
src.h2.stream.H2StreamStateMachine.response_received(previous_state:StreamState) -> list[Event]Fires when a response is received.
method
src.h2.stream.H2StreamStateMachine.response_sent(previous_state:StreamState) -> list[Event]Fires when something that should be a response is sent.
method
src.h2.stream.H2StreamStateMachine.send_alt_svc(previous_state:StreamState) -> list[Event]Called when sending an ALTSVC frame on this stream.
method
src.h2.stream.H2StreamStateMachine.stream_ended(previous_state:StreamState) -> list[Event]Fires when a stream is cleanly ended.
method
src.h2.stream.H2StreamStateMachine.stream_reset(previous_state:StreamState) -> list[Event]Fired when a stream is forcefully reset.
method
src.h2.stream.H2StreamStateMachine.window_updated(previous_state:StreamState) -> list[Event]Fires when a window update frame is received.
func
src.h2.utilities.extract_method_header(headers:Iterable[Header]) -> bytes | NoneExtracts the request method from the headers list.
class
src.h2.windows.WindowManagerA basic HTTP/2 window manager.
method
src.h2.windows.WindowManager.window_consumed(size:int) -> NoneWe have received a certain number of bytes from the remote peer.
About this data
These signatures were extracted from the public source of python-hyper/h2
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.