sdkagent

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

KindCount
Classes18
Functions1
Methods38

API list

classsrc.h2._typing.Buffer
An object implementing the PEP 688 buffer protocol.
methodsrc.h2.config.DummyLogger.debug(*vargs, **kwargs) -> None
No-op logging.
methodsrc.h2.config.DummyLogger.trace(*vargs, **kwargs) -> None
No-op logging.
classsrc.h2.connection.H2Connection
A low-level HTTP/2 connection object.
methodsrc.h2.connection.H2Connection.close_connection(error_code:ErrorCodes | int=0, additional_data:bytes | None=None, last_stream_id:int | None=None) -> None
Close a connection, emitting a GOAWAY frame.
methodsrc.h2.connection.H2Connection.data_to_send(amount:int | None=None) -> bytes
Returns some data for sending out of the internal data buffer.
methodsrc.h2.connection.H2Connection.end_stream(stream_id:int) -> None
Cleanly end a given stream.
methodsrc.h2.connection.H2Connection.open_inbound_streams() -> int
The current number of open inbound streams.
methodsrc.h2.connection.H2Connection.open_outbound_streams() -> int
The current number of open outbound streams.
methodsrc.h2.connection.H2Connection.ping(opaque_data:bytes | str) -> None
Send a PING frame.
methodsrc.h2.connection.H2Connection.prioritize(stream_id:int, weight:int | None=None, depends_on:int | None=None, exclusive:bool | None=None) -> None
Notify a server about the priority of a stream.
methodsrc.h2.connection.H2Connection.receive_data(data:Buffer) -> list[Event]
Pass some received HTTP/2 data to the connection for handling.
methodsrc.h2.connection.H2Connection.reset_stream(stream_id:int, error_code:ErrorCodes | int=0) -> None
Reset a stream.
methodsrc.h2.connection.H2Connection.send_data(stream_id:int, data:bytes | memoryview, end_stream:bool=False, pad_length:Any=None) -> None
Send data on a given stream.
methodsrc.h2.connection.H2Connection.update_settings(new_settings:dict[SettingCodes | int, int]) -> None
Update the local settings.
classsrc.h2.connection.H2ConnectionStateMachine
A single HTTP/2 connection state machine.
methodsrc.h2.connection.H2ConnectionStateMachine.process_input(input_:ConnectionInputs) -> list[Event]
Process a specific input in the state machine.
classsrc.h2.errors.ErrorCodes
All known HTTP/2 error codes.
classsrc.h2.events.Event
Base class for h2 events.
classsrc.h2.events.PingReceived
The PingReceived event is fired whenever a PING is received.
classsrc.h2.events.StreamReset
The StreamReset event is fired in two situations.
classsrc.h2.exceptions.FlowControlError
An attempted action violates flow control constraints.
classsrc.h2.exceptions.FrameDataMissingError
The frame that we received is missing some data.
classsrc.h2.exceptions.H2Error
The base class for all exceptions for the HTTP/2 module.
classsrc.h2.exceptions.InvalidSettingsValueError
An attempt was made to set an invalid Settings value.
classsrc.h2.exceptions.NoAvailableStreamIDError
There are no available stream IDs left to the connection.
classsrc.h2.exceptions.ProtocolError
An action was attempted in violation of the HTTP/2 protocol.
classsrc.h2.settings.SettingCodes
All known HTTP/2 setting codes.
classsrc.h2.settings.Settings
An object that encapsulates HTTP/2 settings state.
classsrc.h2.stream.H2Stream
A low-level HTTP/2 stream object.
methodsrc.h2.stream.H2Stream.advertise_alternative_service(field_value:bytes) -> list[Frame]
Advertise an RFC 7838 alternative service.
methodsrc.h2.stream.H2Stream.closed() -> bool
Whether the stream is closed.
methodsrc.h2.stream.H2Stream.end_stream() -> list[Frame]
End a stream without sending data.
methodsrc.h2.stream.H2Stream.locally_pushed() -> list[Frame]
Mark this stream as one that was pushed by this peer.
methodsrc.h2.stream.H2Stream.receive_alt_svc(frame:AltSvcFrame) -> tuple[list[Frame], list[Event]]
An Alternative Service frame was received on the stream.
methodsrc.h2.stream.H2Stream.receive_continuation() -> None
A naked CONTINUATION frame has been received.
methodsrc.h2.stream.H2Stream.receive_data(data:bytes, end_stream:bool, flow_control_len:int) -> tuple[list[Frame], list[Event]]
Receive some data.
methodsrc.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).
methodsrc.h2.stream.H2Stream.receive_window_update(increment:int) -> tuple[list[Frame], list[Event]]
Handle a WINDOW_UPDATE increment.
methodsrc.h2.stream.H2Stream.reset_stream(error_code:ErrorCodes | int=0) -> list[Frame]
Close the stream locally.
methodsrc.h2.stream.H2Stream.send_data(data:bytes | memoryview, end_stream:bool=False, pad_length:int | None=None) -> list[Frame]
Prepare some data frames.
methodsrc.h2.stream.H2Stream.stream_reset(frame:RstStreamFrame) -> tuple[list[Frame], list[Event]]
Handle a stream being reset remotely.
classsrc.h2.stream.H2StreamStateMachine
A single HTTP/2 stream state machine.
methodsrc.h2.stream.H2StreamStateMachine.data_received(previous_state:StreamState) -> list[Event]
Fires when data is received.
methodsrc.h2.stream.H2StreamStateMachine.process_input(input_:StreamInputs) -> list[Event]
Process a specific input in the state machine.
methodsrc.h2.stream.H2StreamStateMachine.recv_alt_svc(previous_state:StreamState) -> list[Event]
Called when receiving an ALTSVC frame.
methodsrc.h2.stream.H2StreamStateMachine.request_received(previous_state:StreamState) -> list[Event]
Fires when a request is received.
methodsrc.h2.stream.H2StreamStateMachine.request_sent(previous_state:StreamState) -> list[Event]
Fires when a request is sent.
methodsrc.h2.stream.H2StreamStateMachine.response_received(previous_state:StreamState) -> list[Event]
Fires when a response is received.
methodsrc.h2.stream.H2StreamStateMachine.response_sent(previous_state:StreamState) -> list[Event]
Fires when something that should be a response is sent.
methodsrc.h2.stream.H2StreamStateMachine.send_alt_svc(previous_state:StreamState) -> list[Event]
Called when sending an ALTSVC frame on this stream.
methodsrc.h2.stream.H2StreamStateMachine.stream_ended(previous_state:StreamState) -> list[Event]
Fires when a stream is cleanly ended.
methodsrc.h2.stream.H2StreamStateMachine.stream_reset(previous_state:StreamState) -> list[Event]
Fired when a stream is forcefully reset.
methodsrc.h2.stream.H2StreamStateMachine.window_updated(previous_state:StreamState) -> list[Event]
Fires when a window update frame is received.
funcsrc.h2.utilities.extract_method_header(headers:Iterable[Header]) -> bytes | None
Extracts the request method from the headers list.
classsrc.h2.windows.WindowManager
A basic HTTP/2 window manager.
methodsrc.h2.windows.WindowManager.window_consumed(size:int) -> None
We 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.

Back to all 805 libraries