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

Method __request_callback

tests/Framework.py:352–378  ·  view source on GitHub ↗
(self, request, uri, response_headers)

Source from the content-addressed store, hash-verified

350 return (base, sorted(qs.split("&")))
351
352 def __request_callback(self, request, uri, response_headers):
353 request = self.__readNextRequest(self.__cnx.verb, self.__cnx.url, self.__cnx.input, self.__cnx.headers)
354
355 status = int(self.__file.readline())
356 self.response_headers = CaseInsensitiveDict(eval(self.__file.readline()))
357 if self.__stream:
358 output = BytesIO()
359 while True:
360 line = self.__file.readline()
361 if not line:
362 break
363 output.write(base64.b64decode(line))
364 output = output.getvalue()
365 else:
366 output = bytearray(self.__file.readline(), "utf-8")
367 self.__file.readline()
368
369 # make a copy of the headers and remove the ones that interfere with the response handling
370 adding_headers = CaseInsensitiveDict(self.response_headers)
371 adding_headers.pop("content-length", None)
372 adding_headers.pop("transfer-encoding", None)
373 adding_headers.pop("content-encoding", None)
374
375 response_headers.update(adding_headers)
376 self.addRequest(request.with_response(status, response_headers, output))
377
378 return [status, response_headers, output]
379
380 def getresponse(self):
381 response = self.__cnx.getresponse()

Callers 1

requestMethod · 0.95

Calls 6

__readNextRequestMethod · 0.95
readlineMethod · 0.80
writeMethod · 0.80
addRequestMethod · 0.80
with_responseMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected