asyncio.set_event_loop()

asyncio.set_event_loop(loop) Equivalent to calling get_event_loop_policy().set_event_loop(loop).

asyncio.set_event_loop_policy()

asyncio.set_event_loop_policy(policy) Set the current event loop policy. If policy is None, the default policy is restored.

asyncio.sleep()

coroutine asyncio.sleep(delay, result=None, *, loop=None) Create a coroutine that completes after a given time (in seconds). If result is provided, it is produced to the caller when the coroutine completes. The resolution of the sleep depends on the granularity of the event loop. This function is a coroutine.

asyncio.Server.sockets

sockets List of socket.socket objects the server is listening to, or None if the server is closed.

asyncio.Server.wait_closed()

coroutine wait_closed() Wait until the close() method completes. This method is a coroutine.

asyncio.Server

class asyncio.Server Server listening on sockets. Object created by the AbstractEventLoop.create_server() method and the start_server() function. Don’t instantiate the class directly. close() Stop serving: close listening sockets and set the sockets attribute to None. The sockets that represent existing incoming client connections are left open. The server is closed asynchronously, use the wait_closed() coroutine to wait until the server is closed. coroutine wait_closed() Wait until

asyncio.Server.close()

close() Stop serving: close listening sockets and set the sockets attribute to None. The sockets that represent existing incoming client connections are left open. The server is closed asynchronously, use the wait_closed() coroutine to wait until the server is closed.

asyncio.Semaphore.release()

release() Release a semaphore, incrementing the internal counter by one. When it was zero on entry and another coroutine is waiting for it to become larger than zero again, wake up that coroutine.

asyncio.Semaphore

class asyncio.Semaphore(value=1, *, loop=None) A Semaphore implementation. A semaphore manages an internal counter which is decremented by each acquire() call and incremented by each release() call. The counter can never go below zero; when acquire() finds that it is zero, it blocks, waiting until some other coroutine calls release(). Semaphores also support the context management protocol. The optional argument gives the initial value for the internal counter; it defaults to 1. If the value

asyncio.Semaphore.acquire()

coroutine acquire() Acquire a semaphore. If the internal counter is larger than zero on entry, decrement it by one and return True immediately. If it is zero on entry, block, waiting until some other coroutine has called release() to make it larger than 0, and then return True. This method is a coroutine.