This module contains some utility functions.
Return a serializer for arrow dates.
The return value is an argument tuple for
create_task(coro_or_future, *, ignore_cancel=True, loop=None)¶
asyncio.ensure_future()with coro_or_future and set a callback that instantly raises all exceptions.
If the argument is a coroutine, a
asyncio.Taskobject is returned. If the argument is a Future, it is returned directly.
If ignore_cancel is left
True, no exception is raised if the task was canceled. If you also want to raise the
CancelledError, set the flag to
The difference between this function and
asyncio.ensure_future()is the behavior when an exception occurs within the background task:
Exceptions that occur within the background task are normally only raised when you
awaitthat task. If you start a background task that runs “forever”, you will only see the exception when your program ends and you either
awaitthe task or if the task object gets garbage collected (in which case the exception is just printed to stderr).
That means that your program can crash and you won’t notice it because no exception is actually raised or printed. To make development and debugging easier, this function adds a callback to the background task that will re-raise all exceptions immediately.
async(coro_or_future, ignore_cancel=True, loop=None)¶
Deprecated alias to
Run the event loop forever or until the task/future until is finished.
This is an alias to asyncio’s
run_forever()if until is
make_ssl_server_context(cafile, certfile, keyfile)¶
ssl.SSLContextthat can be used by a server socket.
The server will use the certificate in certfile and private key in keyfile (both in PEM format) to authenticate itself.
It requires clients to also authenticate themselves. Their certificates will be validated with the root CA certificate in cafile.
It will use TLS 1.2 with ECDH+AESGCM encryption. ECDH keys won’t be reused in distinct SSL sessions. Compression is disabled.
make_ssl_client_context(cafile, certfile, keyfile)¶
ssl.SSLContextthat can be used by a client socket.
It uses the root CA certificate in cafile to validate the server’s certificate. It will also check the server’s hostname.
The client will use the certificate in certfile and private key in keyfile (both in PEM format) to authenticate itself.
It will use TLS 1.2 with ECDH+AESGCM encryption.
Return the object that the string obj_path points to.
The format of obj_path is
mod:objwhere mod is a (possibly nested) module name and obj is an
.separate object path, for example:
module:Class module:Class.function package.module:Class package.module:Class.function