[requests] Add requests.compat.JSONDecodeError (#15545)

Also add a comment that `JSONDecodeError` may be imported from
`simplejson` if that is installed.
This commit is contained in:
Sebastian Rittau
2026-03-23 15:08:55 +01:00
committed by GitHub
parent 1858acbb36
commit c48ede8b17
2 changed files with 4 additions and 1 deletions
+3
View File
@@ -1,5 +1,8 @@
from builtins import bytes as bytes, str as str
from collections import OrderedDict as OrderedDict
# If simplejson is installed, JSONDecodeError is actually imported from there.
from json import JSONDecodeError as JSONDecodeError
from typing import Literal
from typing_extensions import TypeAlias
from urllib.parse import (
+1 -1
View File
@@ -1,8 +1,8 @@
from json import JSONDecodeError as CompatJSONDecodeError
from typing import Any
from urllib3.exceptions import HTTPError as BaseHTTPError
from .compat import JSONDecodeError as CompatJSONDecodeError
from .models import Request, Response
from .sessions import PreparedRequest