AsyncHttpTransport Class

An http sender ABC.

Inheritance
AsyncHttpTransport
AsyncHttpTransport
AsyncHttpTransport

Constructor

AsyncHttpTransport()

Methods

close

Close the session if it is not externally owned.

open

Assign new session if one does not already exist.

send

Send the request using this HTTP sender.

sleep

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.

close

Close the session if it is not externally owned.

abstract async close() -> None

open

Assign new session if one does not already exist.

abstract async open() -> None

send

Send the request using this HTTP sender.

abstract async send(request: HTTPRequestType, **kwargs: Any) -> AsyncHTTPResponseType

Parameters

Name Description
request
Required
any

The request object. Exact type can be inferred from the pipeline.

Returns

Type Description
any

The response object. Exact type can be inferred from the pipeline.

sleep

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.

async sleep(duration: float) -> None

Parameters

Name Description
duration
Required

The number of seconds to sleep.