Skip to content

requests.JSONDecodeError missing from types-requests #7072

@DataGhost

Description

@DataGhost

While requests.exceptions.JSONDecodeError was added in 032e6ee in types-requests, that covers only one of the two exposed instances. It was also imported into the top level of requests (psf/requests@db575ee, requests/__init__.py), which is not reflected in the stubs here. Using requests.JSONDecodeError in code will cause mypy to complain:

error: Module has no attribute "JSONDecodeError" [attr-defined]

while code using this definition works fine. Changing that line to use requests.exceptions.JSONDecodeError makes the mypy error go away, while not changing anything in the execution except that the line itself is longer.

It looks like it should be imported between these two lines:

HTTPError as HTTPError,
ReadTimeout as ReadTimeout,

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