Send a request with multi-part encoding. :param input: request body, will be serialized as multipart form data :returns:``(status, headers, body)``
(
self,
verb: str,
url: str,
parameters: dict[str, Any] | None = None,
headers: dict[str, Any] | None = None,
input: dict[str, str] | None = None,
cnx: HTTPRequestsConnectionClass | HTTPSRequestsConnectionClass | None = None,
)
| 1078 | raise ValueError("requestJson() Expected a str, should never happen") |
| 1079 | |
| 1080 | def requestMultipart( |
| 1081 | self, |
| 1082 | verb: str, |
| 1083 | url: str, |
| 1084 | parameters: dict[str, Any] | None = None, |
| 1085 | headers: dict[str, Any] | None = None, |
| 1086 | input: dict[str, str] | None = None, |
| 1087 | cnx: HTTPRequestsConnectionClass | HTTPSRequestsConnectionClass | None = None, |
| 1088 | ) -> tuple[int, dict[str, Any], str]: |
| 1089 | """ |
| 1090 | Send a request with multi-part encoding. |
| 1091 | |
| 1092 | :param input: request body, will be serialized as multipart form data |
| 1093 | :returns:``(status, headers, body)`` |
| 1094 | |
| 1095 | """ |
| 1096 | |
| 1097 | def encode(input: dict[str, Any]) -> tuple[str, str]: |
| 1098 | boundary = "----------------------------3c3ba8b523b2" |
| 1099 | eol = "\r\n" |
| 1100 | |
| 1101 | encoded_input = "" |
| 1102 | for name, value in input.items(): |
| 1103 | encoded_input += f"--{boundary}{eol}" |
| 1104 | encoded_input += f'Content-Disposition: form-data; name="{name}"{eol}' |
| 1105 | encoded_input += eol |
| 1106 | encoded_input += value + eol |
| 1107 | encoded_input += f"--{boundary}--{eol}" |
| 1108 | return f"multipart/form-data; boundary={boundary}", encoded_input |
| 1109 | |
| 1110 | status, responseHeaders, output = self.__requestEncode(cnx, verb, url, parameters, headers, input, encode) |
| 1111 | if isinstance(output, str): |
| 1112 | return status, responseHeaders, output |
| 1113 | raise ValueError("requestMultipart() Expected a str, should never happen") |
| 1114 | |
| 1115 | def requestBlob( |
| 1116 | self, |
no test coverage detected