(
self,
body: _TYPE_BODY = "",
headers: typing.Mapping[str, str] | typing.Mapping[bytes, bytes] | None = None,
status: int = 0,
version: int = 0,
version_string: str = "HTTP/?",
reason: str | None = None,
preload_content: bool = True,
decode_content: bool = True,
original_response: _HttplibHTTPResponse | None = None,
pool: HTTPConnectionPool | None = None,
connection: HTTPConnection | None = None,
msg: _HttplibHTTPMessage | None = None,
retries: Retry | None = None,
enforce_content_length: bool = True,
request_method: str | None = None,
request_url: str | None = None,
auto_close: bool = True,
sock_shutdown: typing.Callable[[int], None] | None = None,
)
| 720 | """ |
| 721 | |
| 722 | def __init__( |
| 723 | self, |
| 724 | body: _TYPE_BODY = "", |
| 725 | headers: typing.Mapping[str, str] | typing.Mapping[bytes, bytes] | None = None, |
| 726 | status: int = 0, |
| 727 | version: int = 0, |
| 728 | version_string: str = "HTTP/?", |
| 729 | reason: str | None = None, |
| 730 | preload_content: bool = True, |
| 731 | decode_content: bool = True, |
| 732 | original_response: _HttplibHTTPResponse | None = None, |
| 733 | pool: HTTPConnectionPool | None = None, |
| 734 | connection: HTTPConnection | None = None, |
| 735 | msg: _HttplibHTTPMessage | None = None, |
| 736 | retries: Retry | None = None, |
| 737 | enforce_content_length: bool = True, |
| 738 | request_method: str | None = None, |
| 739 | request_url: str | None = None, |
| 740 | auto_close: bool = True, |
| 741 | sock_shutdown: typing.Callable[[int], None] | None = None, |
| 742 | ) -> None: |
| 743 | super().__init__( |
| 744 | headers=headers, |
| 745 | status=status, |
| 746 | version=version, |
| 747 | version_string=version_string, |
| 748 | reason=reason, |
| 749 | decode_content=decode_content, |
| 750 | request_url=request_url, |
| 751 | retries=retries, |
| 752 | ) |
| 753 | |
| 754 | self.enforce_content_length = enforce_content_length |
| 755 | self.auto_close = auto_close |
| 756 | |
| 757 | self._body = None |
| 758 | self._uncached_read_occurred = False |
| 759 | self._fp: _HttplibHTTPResponse | None = None |
| 760 | self._original_response = original_response |
| 761 | self._fp_bytes_read = 0 |
| 762 | self.msg = msg |
| 763 | |
| 764 | if body and isinstance(body, (str, bytes)): |
| 765 | self._body = body |
| 766 | |
| 767 | self._pool = pool |
| 768 | self._connection = connection |
| 769 | |
| 770 | if hasattr(body, "read"): |
| 771 | self._fp = body # type: ignore[assignment] |
| 772 | self._sock_shutdown = sock_shutdown |
| 773 | |
| 774 | # Are we using the chunked-style of transfer encoding? |
| 775 | self.chunk_left: int | None = None |
| 776 | |
| 777 | # Determine length of response |
| 778 | self.length_remaining = self._init_length(request_method) |
| 779 |
nothing calls this directly
no test coverage detected