Home / Class/ JSONDecodeError Class — requests Architecture

JSONDecodeError Class — requests Architecture

Architecture documentation for the JSONDecodeError class in exceptions.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  2d14a772_615c_c670_32ea_a875f1f37750["JSONDecodeError"]
  ba3ce29c_990f_3605_f8c7_cd00bd19f80a["InvalidJSONError"]
  2d14a772_615c_c670_32ea_a875f1f37750 -->|extends| ba3ce29c_990f_3605_f8c7_cd00bd19f80a
  f4a2f4ac_0336_89fc_eb3c_2c88c34f05a8["exceptions.py"]
  2d14a772_615c_c670_32ea_a875f1f37750 -->|defined in| f4a2f4ac_0336_89fc_eb3c_2c88c34f05a8
  39ada2d2_6538_e3b2_953a_84ed9664e549["__init__()"]
  2d14a772_615c_c670_32ea_a875f1f37750 -->|method| 39ada2d2_6538_e3b2_953a_84ed9664e549
  2b9e85be_370d_81a4_a34d_de6d1d409d5a["__reduce__()"]
  2d14a772_615c_c670_32ea_a875f1f37750 -->|method| 2b9e85be_370d_81a4_a34d_de6d1d409d5a

Relationship Graph

Source Code

src/requests/exceptions.py lines 32–53

class JSONDecodeError(InvalidJSONError, CompatJSONDecodeError):
    """Couldn't decode the text into json"""

    def __init__(self, *args, **kwargs):
        """
        Construct the JSONDecodeError instance first with all
        args. Then use it's args to construct the IOError so that
        the json specific args aren't used as IOError specific args
        and the error message from JSONDecodeError is preserved.
        """
        CompatJSONDecodeError.__init__(self, *args)
        InvalidJSONError.__init__(self, *self.args, **kwargs)

    def __reduce__(self):
        """
        The __reduce__ method called when pickling the object must
        be the one from the JSONDecodeError (be it json/simplejson)
        as it expects all the arguments for instantiation, not just
        one like the IOError, and the MRO would by default call the
        __reduce__ method from the IOError due to the inheritance order.
        """
        return CompatJSONDecodeError.__reduce__(self)

Domain

Frequently Asked Questions

What is the JSONDecodeError class?
JSONDecodeError is a class in the requests codebase, defined in src/requests/exceptions.py.
Where is JSONDecodeError defined?
JSONDecodeError is defined in src/requests/exceptions.py at line 32.
What does JSONDecodeError extend?
JSONDecodeError extends InvalidJSONError.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free