Using Quart Extensions#

There are a number of extensions for Quart, some of which are listed here,

Supporting sync code in a Quart Extension#

Extension authors can support sync functions by utilising the quart.Quart.ensure_async() method. For example, if the extension provides a view function decorator add ensure_async before calling the decorated function,

def extension(func):
    @wraps(func)
    async def wrapper(*args, **kwargs):
        ...  # Extension logic
        return await current_app.ensure_async(func)(*args, **kwargs)
    return wrapper