MCPcopy
hub / github.com/tornadoweb/tornado / HTTPResponse

Class HTTPResponse

tornado/httpclient.py:574–687  ·  view source on GitHub ↗

HTTP Response object. Attributes: * ``request``: HTTPRequest object * ``code``: numeric HTTP status code, e.g. 200 or 404 * ``reason``: human-readable reason phrase describing the status code * ``headers``: `tornado.httputil.HTTPHeaders` object * ``effective_url``: fina

Source from the content-addressed store, hash-verified

572
573
574class HTTPResponse:
575 """HTTP Response object.
576
577 Attributes:
578
579 * ``request``: HTTPRequest object
580
581 * ``code``: numeric HTTP status code, e.g. 200 or 404
582
583 * ``reason``: human-readable reason phrase describing the status code
584
585 * ``headers``: `tornado.httputil.HTTPHeaders` object
586
587 * ``effective_url``: final location of the resource after following any
588 redirects
589
590 * ``buffer``: ``cStringIO`` object for response body
591
592 * ``body``: response body as bytes (created on demand from ``self.buffer``)
593
594 * ``error``: Exception object, if any
595
596 * ``request_time``: seconds from request start to finish. Includes all
597 network operations from DNS resolution to receiving the last byte of
598 data. Does not include time spent in the queue (due to the
599 ``max_clients`` option). If redirects were followed, only includes
600 the final request.
601
602 * ``start_time``: Time at which the HTTP operation started, based on
603 `time.time` (not the monotonic clock used by `.IOLoop.time`). May
604 be ``None`` if the request timed out while in the queue.
605
606 * ``time_info``: dictionary of diagnostic timing information from the
607 request. Available data are subject to change, but currently uses timings
608 available from http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html,
609 plus ``queue``, which is the delay (if any) introduced by waiting for
610 a slot under `AsyncHTTPClient`'s ``max_clients`` setting.
611
612 .. versionadded:: 5.1
613
614 Added the ``start_time`` attribute.
615
616 .. versionchanged:: 5.1
617
618 The ``request_time`` attribute previously included time spent in the queue
619 for ``simple_httpclient``, but not in ``curl_httpclient``. Now queueing time
620 is excluded in both implementations. ``request_time`` is now more accurate for
621 ``curl_httpclient`` because it uses a monotonic clock when available.
622 """
623
624 # I'm not sure why these don't get type-inferred from the references in __init__.
625 error = None # type: Optional[BaseException]
626 _error_is_response_code = False
627 request = None # type: HTTPRequest
628
629 def __init__(
630 self,
631 request: HTTPRequest,

Callers 7

_process_queueMethod · 0.90
_finishMethod · 0.90
_on_timeoutMethod · 0.90
_handle_exceptionMethod · 0.90
finishMethod · 0.90
test_strMethod · 0.90

Calls

no outgoing calls

Tested by 2

test_strMethod · 0.72