MCPcopy
hub / github.com/aio-libs/aiohttp / ClientResponse

Class ClientResponse

aiohttp/client_reqrep.py:516–774  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

514
515
516class ClientResponse:
517
518 # from the Status-Line of the response
519 version = None # HTTP-Version
520 status = None # Status-Code
521 reason = None # Reason-Phrase
522
523 cookies = None # Response cookies (Set-Cookie)
524 content = None # Payload stream
525 headers = None # Response headers, CIMultiDictProxy
526 raw_headers = None # Response raw headers, a sequence of pairs
527
528 _connection = None # current connection
529 flow_control_class = FlowControlStreamReader # reader flow control
530 _reader = None # input stream
531 _response_parser = aiohttp.HttpResponseParser()
532 _source_traceback = None
533 # setted up by ClientRequest after ClientResponse object creation
534 # post-init stage allows to not change ctor signature
535 _loop = None
536 _closed = True # to allow __del__ for non-initialized properly response
537
538 def __init__(self, method, url, host='', *, writer=None, continue100=None):
539 super().__init__()
540
541 self.method = method
542 self.url = url
543 self.host = host
544 self._content = None
545 self._writer = writer
546 self._continue = continue100
547 self._closed = False
548 self._should_close = True # override by message.should_close later
549 self._history = ()
550
551 def _post_init(self, loop):
552 self._loop = loop
553 if loop.get_debug():
554 self._source_traceback = traceback.extract_stack(sys._getframe(1))
555
556 def __del__(self, _warnings=warnings):
557 if self._closed:
558 return
559 self.close()
560
561 _warnings.warn("Unclosed response {!r}".format(self),
562 ResourceWarning)
563 context = {'client_response': self,
564 'message': 'Unclosed response'}
565 if self._source_traceback:
566 context['source_traceback'] = self._source_traceback
567 self._loop.call_exception_handler(context)
568
569 def __repr__(self):
570 out = io.StringIO()
571 print('<ClientResponse({}) [{} {}]>'.format(
572 self.url, self.status, self.reason), file=out)
573 print(self.headers, file=out)

Callers 11

setUpMethod · 0.90
test_delMethod · 0.90
test_wait_for_100_1Method · 0.90
test_wait_for_100_2Method · 0.90
setUpMethod · 0.90
test_https_connectMethod · 0.90
test_https_authMethod · 0.90

Calls

no outgoing calls

Tested by 11

setUpMethod · 0.72
test_delMethod · 0.72
test_wait_for_100_1Method · 0.72
test_wait_for_100_2Method · 0.72
setUpMethod · 0.72
test_https_connectMethod · 0.72
test_https_authMethod · 0.72