Send a request with JSON input. :param input: request body, will be serialized as JSON :returns:``(status, headers, body)``
(
self,
verb: str,
url: str,
parameters: dict[str, Any] | None = None,
headers: dict[str, Any] | None = None,
input: Any | None = None,
cnx: HTTPRequestsConnectionClass | HTTPSRequestsConnectionClass | None = None,
follow_302_redirect: bool = False,
)
| 1050 | raise TypeError(f"Expected a RequestsResponse object: {type(output)}") |
| 1051 | |
| 1052 | def requestJson( |
| 1053 | self, |
| 1054 | verb: str, |
| 1055 | url: str, |
| 1056 | parameters: dict[str, Any] | None = None, |
| 1057 | headers: dict[str, Any] | None = None, |
| 1058 | input: Any | None = None, |
| 1059 | cnx: HTTPRequestsConnectionClass | HTTPSRequestsConnectionClass | None = None, |
| 1060 | follow_302_redirect: bool = False, |
| 1061 | ) -> tuple[int, dict[str, Any], str]: |
| 1062 | """ |
| 1063 | Send a request with JSON input. |
| 1064 | |
| 1065 | :param input: request body, will be serialized as JSON |
| 1066 | :returns:``(status, headers, body)`` |
| 1067 | |
| 1068 | """ |
| 1069 | |
| 1070 | def encode(input: Any) -> tuple[str, str]: |
| 1071 | return "application/json", json.dumps(input) |
| 1072 | |
| 1073 | status, responseHeaders, output = self.__requestEncode( |
| 1074 | cnx, verb, url, parameters, headers, input, encode, follow_302_redirect=follow_302_redirect |
| 1075 | ) |
| 1076 | if isinstance(output, str): |
| 1077 | return status, responseHeaders, output |
| 1078 | raise ValueError("requestJson() Expected a str, should never happen") |
| 1079 | |
| 1080 | def requestMultipart( |
| 1081 | self, |
no test coverage detected