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

Method _send_single_request

httpx/_client.py:1717–1749  ·  view source on GitHub ↗

Sends a single request, without handling any redirections.

(self, request: Request)

Source from the content-addressed store, hash-verified

1715 raise exc
1716
1717 async def _send_single_request(self, request: Request) -> Response:
1718 """
1719 Sends a single request, without handling any redirections.
1720 """
1721 transport = self._transport_for_url(request.url)
1722 start = time.perf_counter()
1723
1724 if not isinstance(request.stream, AsyncByteStream):
1725 raise RuntimeError(
1726 "Attempted to send an sync request with an AsyncClient instance."
1727 )
1728
1729 with request_context(request=request):
1730 response = await transport.handle_async_request(request)
1731
1732 assert isinstance(response.stream, AsyncByteStream)
1733 response.request = request
1734 response.stream = BoundAsyncStream(
1735 response.stream, response=response, start=start
1736 )
1737 self.cookies.extract_cookies(response)
1738 response.default_encoding = self._default_encoding
1739
1740 logger.info(
1741 'HTTP Request: %s %s "%s %d %s"',
1742 request.method,
1743 request.url,
1744 response.http_version,
1745 response.status_code,
1746 response.reason_phrase,
1747 )
1748
1749 return response
1750
1751 async def get(
1752 self,

Callers 1

Calls 6

_transport_for_urlMethod · 0.95
request_contextFunction · 0.85
BoundAsyncStreamClass · 0.85
extract_cookiesMethod · 0.80
infoMethod · 0.80
handle_async_requestMethod · 0.45

Tested by

no test coverage detected