How to use the httpcore.AsyncHTTPTransport function in httpcore

To help you get started, we’ve selected a few httpcore examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lundberg / respx / respx / transports.py View on Github external
self.close()


class SyncMockTransport(BaseMockTransport, SyncHTTPTransport):
    def request(  # type: ignore
        self,
        method: bytes,
        url: URL,
        headers: Headers = None,
        stream: SyncByteStream = None,
        timeout: TimeoutDict = None,
    ) -> Response:
        return self._sync_request(method, url, headers, stream, timeout)


class AsyncMockTransport(BaseMockTransport, AsyncHTTPTransport):
    async def request(  # type: ignore
        self,
        method: bytes,
        url: URL,
        headers: Headers = None,
        stream: AsyncByteStream = None,
        timeout: TimeoutDict = None,
    ) -> Response:
        return await self._async_request(method, url, headers, stream, timeout)