asyncio.wait_for()

coroutine asyncio.wait_for(fut, timeout, *, loop=None)

Wait for the single Future or coroutine object to complete with timeout. If timeout is None, block until the future completes.

Coroutine will be wrapped in Task.

Returns result of the Future or coroutine. When a timeout occurs, it cancels the task and raises asyncio.TimeoutError. To avoid the task cancellation, wrap it in shield().

If the wait is cancelled, the future fut is also cancelled.

This function is a coroutine, usage:

result = yield from asyncio.wait_for(fut, 60.0)

Changed in version 3.4.3: If the wait is cancelled, the future fut is now also cancelled.

doc_python
2016-10-07 17:27:06
Comments
Leave a Comment

Please login to continue.