pip install gevent
With those changes in place, Pykka should run on top of gevent.
It encapsulates a
gevent.event.AsyncResultobject which may be used directly, though it will couple your code with gevent.
Get the value encapsulated by the future.
If the encapsulated value is an exception, it is raised instead of returned.
None, as default, the method will block until it gets a reply, potentially forever. If
timeoutis an integer or float, the method will wait for a reply for
timeoutseconds, and then raise
The encapsulated value can be retrieved multiple times. The future will only block the first time the value is accessed.
Parameters: timeout (float or
None) – seconds to wait before timeout
pykka.Timeoutif timeout is reached
Raise: encapsulated value if it is an exception Returns: encapsulated value if it is not an exception
Set the encapsulated value.
Parameters: value (any object or
None) – the encapsulated value or nothing
Raise: an exception if set is called multiple times
Set an exception as the encapsulated value.
In other words, if you’re calling
set_exception(), without any arguments, from an except block, the exception you’re currently handling will automatically be set on the future.
Parameters: exc_info (three-tuple of (exc_class, exc_instance, traceback)) – the encapsulated exception