June 2017
Beginner to intermediate
274 pages
6h 49m
English
The wait_for coroutine lets us wait for another coroutine to finish but with a timeout. The first two coroutines in the following code example do the same thing except that if foo doesn't finish within 5 seconds, the second version will raise an asyncio timeout error:

In the third code block, we're still doing the same thing, except if foo times out, we print a message. Then, there's the gather coroutine.
Read now
Unlock full access