wreq.http2
Configuration options for HTTP/2 connections, including stream priorities and settings.
wreq.http2
HTTP/2 connection configuration.
PseudoId
Bases: Enum
Represents the order of HTTP/2 pseudo-header fields in the header block.
HTTP/2 pseudo-header fields are a set of predefined header fields that start with ':'. The order of these fields in a header block is significant. This enum defines the possible pseudo-header fields and their standard order according to RFC 7540.
Source code in python/wreq/http2.py
SettingId
Bases: Enum
An enum that lists all valid settings that can be sent in a SETTINGS frame.
Each setting has a value that is a 32 bit unsigned integer (6.5.1.).
See https://datatracker.ietf.org/doc/html/rfc9113#name-defined-settings.
Source code in python/wreq/http2.py
HEADER_TABLE_SIZE
class-attribute
instance-attribute
This setting allows the sender to inform the remote endpoint of the maximum size of the compression table used to decode field blocks, in units of octets. The encoder can select any size equal to or less than this value by using signaling specific to the compression format inside a field block (see COMPRESSION). The initial value is 4,096 octets.
ENABLE_PUSH
class-attribute
instance-attribute
Enables or disables server push.
MAX_CONCURRENT_STREAMS
class-attribute
instance-attribute
Specifies the maximum number of concurrent streams.
INITIAL_WINDOW_SIZE
class-attribute
instance-attribute
Sets the initial stream-level flow control window size.
MAX_FRAME_SIZE
class-attribute
instance-attribute
Indicates the largest acceptable frame payload size.
MAX_HEADER_LIST_SIZE
class-attribute
instance-attribute
Advises the peer of the max field section size.
ENABLE_CONNECT_PROTOCOL
class-attribute
instance-attribute
Enables support for the Extended CONNECT protocol.
StreamId
A stream identifier, as described in Section 5.1.1 of RFC 7540.
Streams are identified with an unsigned 31-bit integer. Streams initiated by a client MUST use odd-numbered stream identifiers; those initiated by the server MUST use even-numbered stream identifiers. A stream identifier of zero (0x0) is used for connection control messages; the stream identifier of zero cannot be used to establish a new stream.
Source code in python/wreq/http2.py
__init__
StreamDependency
Represents a stream dependency in HTTP/2 priority frames.
A stream dependency consists of three components: * A stream identifier that the stream depends on * A weight value between 0 and 255 (representing 1-256 in the protocol) * An exclusive flag indicating whether this is an exclusive dependency
Stream Dependencies
In HTTP/2, stream dependencies form a dependency tree where each stream can depend on another stream. This creates a priority hierarchy that helps determine the relative order in which streams should be processed.
Source code in python/wreq/http2.py
__init__
Priority
Represents an HTTP/2 PRIORITY frame (type=0x2).
The PRIORITY frame specifies the sender-advised priority of a stream, as described in RFC 7540 Section 5.3. It can be sent in any stream state, including idle or closed streams.
A PRIORITY frame consists of: * The stream identifier whose priority is being set * A StreamDependency object describing the dependency and weight
Source code in python/wreq/http2.py
__init__
Priorities
A collection of HTTP/2 PRIORITY frames.
The Priorities class maintains an ordered list of Priority frames, which can be used to represent and manage the stream dependency tree in HTTP/2. This is useful for pre-configuring stream priorities or sending multiple PRIORITY frames at once during connection setup or stream reprioritization.
Source code in python/wreq/http2.py
__init__
PseudoOrder
Represents the order of HTTP/2 pseudo-header fields in the header block.
The PseudoOrder class maintains a list of PseudoId values that define the order in which pseudo-header fields should appear in an HTTP/2 HEADERS frame. This is important because the order of pseudo-headers is significant and must follow specific rules as defined in RFC 7540.
Source code in python/wreq/http2.py
__init__
SettingsOrder
Represents the order of HTTP/2 settings parameters in the SETTINGS frame.
The SettingsOrder class maintains a list of SettingId values that define the order in which settings parameters should appear in an HTTP/2 SETTINGS frame. While the order of settings is not strictly enforced by the protocol, having a consistent order can help with readability and debugging.
Source code in python/wreq/http2.py
__init__
Params
typed-dict
Bases: TypedDict
All parameters for HTTP/2 connections.
Source code in python/wreq/http2.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
__init__
__init__(*, initial_window_size=..., initial_connection_window_size=..., initial_max_send_streams=..., initial_stream_id=..., adaptive_window=..., max_frame_size=..., max_header_list_size=..., header_table_size=..., max_concurrent_streams=..., keep_alive_interval=..., keep_alive_timeout=..., keep_alive_while_idle=..., enable_push=..., enable_connect_protocol=..., no_rfc7540_priorities=..., max_concurrent_reset_streams=..., max_send_buf_size=..., max_pending_accept_reset_streams=..., headers_stream_dependency=..., headers_pseudo_order=..., settings_order=..., priorities=...)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_window_size
|
int
|
Initial window size for HTTP/2 streams. |
...
|
initial_connection_window_size
|
int
|
Initial connection-level window size. |
...
|
initial_max_send_streams
|
int
|
Initial maximum number of send streams. |
...
|
initial_stream_id
|
int
|
Initial stream ID for the connection. |
...
|
adaptive_window
|
bool
|
Whether to use adaptive flow control. |
...
|
max_frame_size
|
int
|
Maximum frame size to use for HTTP/2. |
...
|
max_header_list_size
|
int
|
Maximum size of the header list. |
...
|
header_table_size
|
int
|
Header table size for HPACK compression. |
...
|
max_concurrent_streams
|
int
|
Maximum concurrent streams from remote peer. |
...
|
keep_alive_interval
|
timedelta
|
Interval for HTTP/2 keep-alive ping frames. |
...
|
keep_alive_timeout
|
timedelta
|
Timeout for keep-alive ping acknowledgements. |
...
|
keep_alive_while_idle
|
bool
|
Whether keep-alive applies while idle. |
...
|
enable_push
|
bool
|
Whether to enable push promises. |
...
|
enable_connect_protocol
|
bool
|
Whether to enable the CONNECT protocol. |
...
|
no_rfc7540_priorities
|
bool
|
Whether to disable RFC 7540 Stream Priorities. |
...
|
max_concurrent_reset_streams
|
int
|
Max concurrent locally reset streams. |
...
|
max_send_buf_size
|
int
|
Maximum send buffer size for streams. |
...
|
max_pending_accept_reset_streams
|
int
|
Max pending accept reset streams. |
...
|
headers_stream_dependency
|
StreamDependency
|
Stream dependency for outgoing HEADERS. |
...
|
headers_pseudo_order
|
PseudoOrder
|
Order of pseudo-header fields in HEADERS. |
...
|
settings_order
|
SettingsOrder
|
Order of settings parameters in SETTINGS frame. |
...
|
priorities
|
Priorities
|
List of PRIORITY frames to send after connection. |
...
|
Http2Options
Configuration for an HTTP/2 connection.
This struct defines various parameters to fine-tune the behavior of an HTTP/2 connection, including stream management, window sizes, frame limits, and header config.
Source code in python/wreq/http2.py
__init__
__init__(*, initial_window_size=..., initial_connection_window_size=..., initial_max_send_streams=..., initial_stream_id=..., adaptive_window=..., max_frame_size=..., max_header_list_size=..., header_table_size=..., max_concurrent_streams=..., keep_alive_interval=..., keep_alive_timeout=..., keep_alive_while_idle=..., enable_push=..., enable_connect_protocol=..., no_rfc7540_priorities=..., max_concurrent_reset_streams=..., max_send_buf_size=..., max_pending_accept_reset_streams=..., headers_stream_dependency=..., headers_pseudo_order=..., settings_order=..., priorities=...)
Create a new Http2Options instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_window_size
|
int
|
Initial window size for HTTP/2 streams. |
...
|
initial_connection_window_size
|
int
|
Initial connection-level window size. |
...
|
initial_max_send_streams
|
int
|
Initial maximum number of send streams. |
...
|
initial_stream_id
|
int
|
Initial stream ID for the connection. |
...
|
adaptive_window
|
bool
|
Whether to use adaptive flow control. |
...
|
max_frame_size
|
int
|
Maximum frame size to use for HTTP/2. |
...
|
max_header_list_size
|
int
|
Maximum size of the header list. |
...
|
header_table_size
|
int
|
Header table size for HPACK compression. |
...
|
max_concurrent_streams
|
int
|
Maximum concurrent streams from remote peer. |
...
|
keep_alive_interval
|
timedelta
|
Interval for HTTP/2 keep-alive ping frames. |
...
|
keep_alive_timeout
|
timedelta
|
Timeout for keep-alive ping acknowledgements. |
...
|
keep_alive_while_idle
|
bool
|
Whether keep-alive applies while idle. |
...
|
enable_push
|
bool
|
Whether to enable push promises. |
...
|
enable_connect_protocol
|
bool
|
Whether to enable the CONNECT protocol. |
...
|
no_rfc7540_priorities
|
bool
|
Whether to disable RFC 7540 Stream Priorities. |
...
|
max_concurrent_reset_streams
|
int
|
Max concurrent locally reset streams. |
...
|
max_send_buf_size
|
int
|
Maximum send buffer size for streams. |
...
|
max_pending_accept_reset_streams
|
int
|
Max pending accept reset streams. |
...
|
headers_stream_dependency
|
StreamDependency
|
Stream dependency for outgoing HEADERS. |
...
|
headers_pseudo_order
|
PseudoOrder
|
Order of pseudo-header fields in HEADERS. |
...
|
settings_order
|
SettingsOrder
|
Order of settings parameters in SETTINGS frame. |
...
|
priorities
|
Priorities
|
List of PRIORITY frames to send after connection. |
...
|