Skip to content

Commit c48ede8

Browse files
authored
[requests] Add requests.compat.JSONDecodeError (#15545)
Also add a comment that `JSONDecodeError` may be imported from `simplejson` if that is installed.
1 parent 1858acb commit c48ede8

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

stubs/requests/requests/compat.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
from builtins import bytes as bytes, str as str
22
from collections import OrderedDict as OrderedDict
3+
4+
# If simplejson is installed, JSONDecodeError is actually imported from there.
5+
from json import JSONDecodeError as JSONDecodeError
36
from typing import Literal
47
from typing_extensions import TypeAlias
58
from urllib.parse import (

stubs/requests/requests/exceptions.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from json import JSONDecodeError as CompatJSONDecodeError
21
from typing import Any
32

43
from urllib3.exceptions import HTTPError as BaseHTTPError
54

5+
from .compat import JSONDecodeError as CompatJSONDecodeError
66
from .models import Request, Response
77
from .sessions import PreparedRequest
88

0 commit comments

Comments
 (0)