class asyncio.Future(*, loop=None)  
A Future represents an eventual result of an asynchronous operation. Not thread-safe. Future is an awaitable object. Coroutines can await on Future objects until they either have a result or an exception set, or until they are cancelled. Typically Futures are used to enable low-level callback-based code (e.g. in protocols implemented using asyncio transports) to interoperate with high-level async/await code. The rule of thumb is to never expose Future objects in user-facing APIs, and the recommended way to create a Future object is to call loop.create_future(). This way alternative event loop implementations can inject their own optimized implementations of a Future object.  Changed in version 3.7: Added support for the contextvars module.   
result()  
Return the result of the Future. If the Future is done and has a result set by the set_result() method, the result value is returned. If the Future is done and has an exception set by the set_exception() method, this method raises the exception. If the Future has been cancelled, this method raises a CancelledError exception. If the Future’s result isn’t yet available, this method raises a InvalidStateError exception. 
  
set_result(result)  
Mark the Future as done and set its result. Raises a InvalidStateError error if the Future is already done. 
  
set_exception(exception)  
Mark the Future as done and set an exception. Raises a InvalidStateError error if the Future is already done. 
  
done()  
Return True if the Future is done. A Future is done if it was cancelled or if it has a result or an exception set with set_result() or set_exception() calls. 
  
cancelled()  
Return True if the Future was cancelled. The method is usually used to check if a Future is not cancelled before setting a result or an exception for it: if not fut.cancelled():
    fut.set_result(42)
 
  
add_done_callback(callback, *, context=None)  
Add a callback to be run when the Future is done. The callback is called with the Future object as its only argument. If the Future is already done when this method is called, the callback is scheduled with loop.call_soon(). An optional keyword-only context argument allows specifying a custom contextvars.Context for the callback to run in. The current context is used when no context is provided. functools.partial() can be used to pass parameters to the callback, e.g.: # Call 'print("Future:", fut)' when "fut" is done.
fut.add_done_callback(
    functools.partial(print, "Future:"))
  Changed in version 3.7: The context keyword-only parameter was added. See PEP 567 for more details.  
  
remove_done_callback(callback)  
Remove callback from the callbacks list. Returns the number of callbacks removed, which is typically 1, unless a callback was added more than once. 
  
cancel(msg=None)  
Cancel the Future and schedule callbacks. If the Future is already done or cancelled, return False. Otherwise, change the Future’s state to cancelled, schedule the callbacks, and return True.  Changed in version 3.9: Added the msg parameter.  
  
exception()  
Return the exception that was set on this Future. The exception (or None if no exception was set) is returned only if the Future is done. If the Future has been cancelled, this method raises a CancelledError exception. If the Future isn’t done yet, this method raises an InvalidStateError exception. 
  
get_loop()  
Return the event loop the Future object is bound to.  New in version 3.7.