Skip to content

requests.session().headers #9390

@evilensky

Description

@evilensky

According to this comment in the requests project:

We deliberately allow any mapping type to allow for a variety of use-cases. A change here won't be accepted

I think this means that the strict typing shown here is not correct:

https://github.com/python/typeshed/blob/main/stubs/requests/requests/sessions.pyi#L116

And instead something that satisfies a mutableMapping would be more correct?

The X to my Y problem is that I am very much used to working with .headers set to a built-in dict. And if it works and is supported by requests , could I submit a patch to the type stubs? Satisfying this typing constraint as it is right now feels incorrect given the long history of the dict() being sufficient.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions