Skip to content

requests.Session.headers missing copy method #3042

@connorskees

Description

@connorskees

requests.Session().headers has a type of CaseInsensitiveDict; however, it is defined as being a MutableMapping[Text, Text] and so is missing a copy() method. Mypy incorrectly raises an error, error: "MutableMapping[str, str]" has no attribute "copy"

headers: MutableMapping[Text, Text]

The definition for a CaseInsensitiveDict itself is also missing a copy() method

class CaseInsensitiveDict(MutableMapping[str, _VT], Generic[_VT]):

The copy() method is defined here
https://github.com/kennethreitz/requests/blob/4983a9bde39c6320aa4f3e34e50dac6e263dab6f/requests/structures.py#L80

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions