corehttp.transport package

class corehttp.transport.AsyncHttpTransport[source]

An http sender ABC.

abstract async close() None[source]

Close the session if it is not externally owned.

abstract async open() None[source]

Assign new session if one does not already exist.

abstract async send(request: HTTPRequestType, **kwargs: Any) AsyncHTTPResponseType[source]

Send the request using this HTTP sender.

Parameters:

request (any) – The request object. Exact type can be inferred from the pipeline.

Returns:

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

Return type:

any

async sleep(duration: float) None[source]

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.HttpTransport[source]

An http sender ABC.

abstract close() None[source]

Close the session if it is not externally owned.

abstract open() None[source]

Assign new session if one does not already exist.

abstract send(request: HTTPRequestType, **kwargs: Any) HTTPResponseType[source]

Send the request using this HTTP sender.

Parameters:

request (HTTPRequest) – The pipeline request object

Returns:

The pipeline response object.

Return type:

HttpResponse

sleep(duration: float) None[source]

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.

Subpackages