Repository navigation
Opt-in session request defaults
Version 2.6.0 adds Session.request_defaults and
AsyncSession.request_defaults for reusable headers and string query pairs.
- Defaults are disabled initially. Assign a headers/params configuration to
opt in; assignNoneor{}to clear it. No constructor changes are required. - Configuration is validated and copied atomically; the getter returns a
detached snapshot. Header names merge case-insensitively, and repeated query
pairs retain order. Explicit request values override configured values. - Empty supported inputs and raw queries retain their native bypass behavior.
Defaults merge only before initial preparation, not again on hooks, retries,
redirects or sends of an already prepared request. - Authorization, proxy authorization, Cookies, Host and body-framing headers
remain in their existing APIs and cannot be configured as defaults. - Documentation, executable local examples, public typing and 138 focused
unit/peer cases cover both clients, prepared snapshots and policy boundaries.
Python >=3.7 remains supported. Unconfigured sessions keep their existing
behavior; legacy Session observation properties do not become request defaults.
TLS/H2 engines, browser-profile support and existing timeout/proxy contracts
are unchanged. This release does not claim full Requests or browser parity.
See the configuration guide
and changelog.