MCPcopy
hub / github.com/psf/requests / __init__

Method __init__

src/requests/models.py:763–808  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

761 ]
762
763 def __init__(self) -> None:
764 self._content = False
765 self._content_consumed = False
766 self._next = None
767
768 #: Integer Code of responded HTTP Status, e.g. 404 or 200.
769 self.status_code = None # type: ignore[assignment]
770
771 #: Case-insensitive Dictionary of Response Headers.
772 #: For example, ``headers['content-encoding']`` will return the
773 #: value of a ``'Content-Encoding'`` response header.
774 self.headers = CaseInsensitiveDict()
775
776 #: File-like object representation of response (for advanced usage).
777 #: Use of ``raw`` requires that ``stream=True`` be set on the request.
778 #: This requirement does not apply for use internally to Requests.
779 self.raw = None
780
781 #: Final URL location of Response.
782 self.url = None # type: ignore[assignment]
783
784 #: Encoding to decode with when accessing r.text.
785 self.encoding = None
786
787 #: A list of :class:`Response <Response>` objects from
788 #: the history of the Request. Any redirect responses will end
789 #: up here. The list is sorted from the oldest to the most recent request.
790 self.history = []
791
792 #: Textual reason of responded HTTP Status, e.g. "Not Found" or "OK".
793 self.reason = None # type: ignore[assignment]
794
795 #: A CookieJar of Cookies the server sent back.
796 self.cookies = cookiejar_from_dict({})
797
798 #: The amount of time elapsed between sending the request
799 #: and the arrival of the response (as a timedelta).
800 #: This property specifically measures the time taken between sending
801 #: the first byte of the request and finishing parsing the headers. It
802 #: is therefore unaffected by consuming the response content or the
803 #: value of the ``stream`` keyword argument.
804 self.elapsed = datetime.timedelta(0)
805
806 #: The :class:`PreparedRequest <PreparedRequest>` object to which this
807 #: is a response.
808 self.request = None # type: ignore[assignment]
809
810 def __enter__(self) -> Self:
811 return self

Callers

nothing calls this directly

Calls 2

CaseInsensitiveDictClass · 0.85
cookiejar_from_dictFunction · 0.85

Tested by

no test coverage detected