Skip to main content

Werkzeug for asyncio

Project description

travis-master coverall-master Documentation Status Downloads Latest Version Supported Python versions Development Status License Download format Supported Python implementations

aiowerkzeug

Library to make werkzeug working with asyncio.

Features

  • Locals work on asyncio Tasks. werkzeug.local.Local or werkzeug.local.LocalStack must be patched with aiowerkzeug.local.patch_local

    Patched werkzeug.local.Local or werkzeug.local.LocalStack use current asyncio.tasks.Task to determine context.

  • Decorator factory to mark coroutines to run in a context. Useful for Flask. It allows to run corountines in new asyncio.tasks.Task inside a specific context.

    For example, in Flask to run coroutines in Application context it is possible to create a decorator like that:

    def _get_app_context():
        return current_app.app_context()
    
    app_coroutine = partial(context_coroutine, ctx=_get_app_context)
    
    @app_coroutine
    def foo_bar():
        print(current_app.debug)
    
    @flask_app.route('/')
    def caller():
        asyncio.ensure_future(foo_bar())

TODO

  • Form parser

  • Server powered by aiohttp

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiowerkzeug-0.1.0.tar.gz (3.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page