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

Method requestJson

github/Requester.py:1052–1078  ·  view source on GitHub ↗

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,
    )

Source from the content-addressed store, hash-verified

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,

Callers 15

requestJsonAndCheckMethod · 0.95
updateMethod · 0.80
rerequestMethod · 0.80
has_in_membersMethod · 0.80
has_in_reposMethod · 0.80
cancelMethod · 0.80
rerunMethod · 0.80
rerun_failed_jobsMethod · 0.80
deleteMethod · 0.80
editMethod · 0.80
delete_reactionMethod · 0.80

Calls 1

__requestEncodeMethod · 0.95

Tested by

no test coverage detected