Change8

Migrating to Requests v2.34.2

Version v2.34.2 introduces 2 breaking changes. This guide details how to update your code.

Released: 5/14/2026

2
Breaking Changes
1
Migration Steps
1
Affected Symbols

⚠️ Check Your Code

If you use any of these symbols, you need to read this guide:

Request.headers

Breaking Changes

Issue #1

The type hint for the `headers` input has been reverted to `Mapping`. Code relying on `MutableMapping` or inferred dict types for `Request.headers` might experience issues if they attempt to use methods like `.update()` directly, as the type is now more strictly enforced as immutable.

Issue #2

Users calling `Request.headers.update()` may need to narrow typing in their code to satisfy the new `Mapping` type constraint.

Migration Steps

  1. 1
    If you were relying on mutable dictionary behavior for `Request.headers`, ensure your type annotations reflect the expected `Mapping` type or use explicit casting if mutation is necessary.

Release Summary

This patch reverts the type hint for the `headers` input back to `Mapping` to resolve invariance issues, which may require minor type adjustments for users modifying request headers.

Need More Details?

View the full release notes and all changes for Requests v2.34.2.

View Full Changelog