MCPcopy
hub / github.com/encode/httpx / close

Method close

httpx/_models.py:961–972  ·  view source on GitHub ↗

Close the response and release the connection. Automatically called if the response body is read to completion.

(self)

Source from the content-addressed store, hash-verified

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 """

Callers 3

iter_rawMethod · 0.95
test_close_on_asyncFunction · 0.95

Calls 1

request_contextFunction · 0.85

Tested by 2

test_close_on_asyncFunction · 0.76