MCPcopy Index your code
hub / github.com/PyGithub/PyGithub / requestMemoryBlobAndCheck

Method requestMemoryBlobAndCheck

github/Requester.py:1151–1179  ·  view source on GitHub ↗

Send a request with a binary file-like for the body. :param file_like: file-like object to use for the request body :return: ``(headers: dict, JSON Response: Any)`` :raises: :class:`GithubException` for error status codes

(
        self,
        verb: str,
        url: str,
        parameters: Any,
        headers: dict[str, Any],
        file_like: BinaryIO,
        cnx: HTTPRequestsConnectionClass | HTTPSRequestsConnectionClass | None = None,
    )

Source from the content-addressed store, hash-verified

1149 raise ValueError("requestBlob() Expected a str, should never happen")
1150
1151 def requestMemoryBlobAndCheck(
1152 self,
1153 verb: str,
1154 url: str,
1155 parameters: Any,
1156 headers: dict[str, Any],
1157 file_like: BinaryIO,
1158 cnx: HTTPRequestsConnectionClass | HTTPSRequestsConnectionClass | None = None,
1159 ) -> tuple[dict[str, Any], Any]:
1160 """
1161 Send a request with a binary file-like for the body.
1162
1163 :param file_like: file-like object to use for the request body
1164 :return: ``(headers: dict, JSON Response: Any)``
1165 :raises: :class:`GithubException` for error status codes
1166
1167 """
1168
1169 # The expected signature of encode means that the argument is ignored.
1170 def encode(_: Any) -> tuple[str, Any]:
1171 return headers["Content-Type"], file_like
1172
1173 if not cnx:
1174 cnx = self.__customConnection(url)
1175
1176 status, responseHeaders, output = self.__requestEncode(cnx, verb, url, parameters, headers, file_like, encode)
1177 if isinstance(output, str):
1178 return self.__postProcess(verb, url, *self.__check(status, responseHeaders, output))
1179 raise ValueError("requestMemoryBlobAndCheck() Expected a str, should never happen")
1180
1181 def __requestEncode(
1182 self,

Callers 1

Calls 4

__customConnectionMethod · 0.95
__requestEncodeMethod · 0.95
__postProcessMethod · 0.95
__checkMethod · 0.95

Tested by

no test coverage detected