Close the response and release the connection. Automatically called if the response body is read to completion.
(self)
| 959 | self.close() |
| 960 | |
| 961 | def close(self) -> None: |
| 962 | """ |
| 963 | Close the response and release the connection. |
| 964 | Automatically called if the response body is read to completion. |
| 965 | """ |
| 966 | if not isinstance(self.stream, SyncByteStream): |
| 967 | raise RuntimeError("Attempted to call an sync close on an async stream.") |
| 968 | |
| 969 | if not self.is_closed: |
| 970 | self.is_closed = True |
| 971 | with request_context(request=self._request): |
| 972 | self.stream.close() |
| 973 | |
| 974 | async def aread(self) -> bytes: |
| 975 | """ |