Class Future (0.44.0)

Future(completed=None)

This future object is returned from asychronous Pub/Sub publishing calls.

Calling result will resolve the future by returning the message ID, unless an error occurs.

Methods

add_done_callback

add_done_callback(callback)

Attach the provided callable to the future.

The provided function is called, with this future as its only argument, when the future finishes running.

Parameter
NameDescription
callback Callable

The function to call.

cancel

cancel()

Actions in Pub/Sub generally may not be canceled.

This method always returns False.

cancelled

cancelled()

Actions in Pub/Sub generally may not be canceled.

This method always returns False.

done

done()

Return True the future is done, False otherwise.

This still returns True in failure cases; checking result or exception is the canonical way to assess success or failure.

exception

exception(timeout=None)

Return the exception raised by the call, if any.

Parameter
NameDescription
timeout Union[int, float]

The number of seconds before this call times out and raises TimeoutError.

Exceptions
TypeDescription
TimeoutErrorIf the request times out.
Returns
TypeDescription
ExceptionThe exception raised by the call, if any.