def with_json_body(self, body):
        """Sets the request body to the provided value and returns the request itself.
        Also sets the Content-Type header to application/json.

        Keyword arguments:
        body -- A body that is either accepted by with_body or is convertible to (or is) a dict object.
            If a dict-like object is provided, it will be converted to a json string using json.dumps.
        """
        try:
            self.with_body(json.dumps(dict(body)))
        except:
            try:
                self.with_body(body)
            except:
                raise ValueError("Request body must be a string, bytes object, or a dict structure corresponding to a valid JSON.")
        self.header["Content-Type"] = "application/json"
        return self
def with_json_body ( self , body ) : try : self . with_body ( json . dumps ( dict ( body ) ) ) except : try : self . with_body ( body ) except : raise ValueError ( "Request body must be a string, bytes object, or a dict structure corresponding to a valid JSON." ) self . header [ "Content-Type" ] = "application/json" return self
Sets the request body to the provided value and returns the request itself.
        Also sets the Content-Type header to application/json.

        Keyword arguments:
        body -- A body that is either accepted by with_body or is convertible to (or is) a dict object.
            If a dict-like object is provided, it will be converted to a json string using json.dumps.