corehttp.transport.httpx package¶
- class corehttp.transport.httpx.AsyncHttpXTransport(*, client: AsyncClient | None = None, client_owner: bool = True, use_env_settings: bool = True, **kwargs: Any)[source]¶
Implements a basic async httpx HTTP sender
- Keyword Arguments:
- async send(request: HttpRequest, *, stream: bool = False, **kwargs) AsyncHttpResponse [source]¶
Send the request using this HTTP sender.
- Parameters:
request (HttpRequest) – The request object to be sent.
- Keyword Arguments:
stream (bool) – Whether to stream the response. Defaults to False.
- Returns:
The response object.
- Return type:
- async sleep(duration: float) None ¶
Sleep for the specified duration.
You should always ask the transport to sleep, and not call directly the stdlib. This is mostly important in async, as the transport may not use asyncio but other implementation like trio and they their own way to sleep, but to keep design consistent, it’s cleaner to always ask the transport to sleep and let the transport implementor decide how to do it. By default, this method will use “asyncio”, and don’t need to be overridden if your transport does too.
- Parameters:
duration (float) – The number of seconds to sleep.
- class corehttp.transport.httpx.HttpXTransport(*, client: Client | None = None, client_owner: bool = True, use_env_settings: bool = True, **kwargs: Any)[source]¶
Implements a basic httpx HTTP sender
- Keyword Arguments:
- send(request: HttpRequest, *, stream: bool = False, **kwargs) HttpResponse [source]¶
Send a request and get back a response.
- Parameters:
request (HTTPRequest) – The request object to be sent.
- Keyword Arguments:
stream (bool) – Whether to stream the response. Defaults to False.
- Returns:
An HTTPResponse object.
- Return type:
- sleep(duration: float) None ¶
Sleep for the specified duration.
You should always ask the transport to sleep, and not call directly the stdlib. This is mostly important in async, as the transport may not use asyncio but other implementations like trio and they have their own way to sleep, but to keep design consistent, it’s cleaner to always ask the transport to sleep and let the transport implementor decide how to do it.
- Parameters:
duration (float) – The number of seconds to sleep.