This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

asyncwsgi is a simple package for tornado and asyncio(WIP) to enable the use of the WSGI interface asynchronously. Behind the scenes greenlet is used to pause and resume each request.

Usage

  1. Decorate functions that require async with asyncwsgi.coroutine
  2. Use asyncwsgi.wrap to wrap the WSGI container.
  3. Run the event loop using asyncwsgi.run

Examples

Django

@asyncwsgi.coroutine
def my_view(request):
    http_client = AsyncHTTPClient()
    response = yield http_client.fetch('http://www.google.com/')
    return render(request, 'my_view.html', {'code': response.code})

...
# Patch django to run on tornado's event loop
def run(host, port, app, **options):
    container = asyncwsgi.wrap(WSGIContainer(app))
    http_server = HTTPServer(container)
    http_server.listen(port, host)
    asyncwsgi.run(IOLoop.current())

if __name__ == "__main__":
    ...
    from django.core.management.commands import runserver
    runserver.run = run

Bottle

import asyncwsgi
import bottle
from tornado.httpclient import AsyncHTTPClient
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop

@bottle.get('/')
@asyncwsgi.coroutine
def index():
    http_client = AsyncHTTPClient()
    response = yield http_client.fetch('http://www.google.com/')
    return 'Status: %d' % response.code

container = asyncwsgi.wrap(WSGIContainer(bottle.default_app()))
http_server = HTTPServer(container)
http_server.listen(8080)
asyncwsgi.run(IOLoop.current())

Installation

pip install asyncwsgi

Todo

  • asyncio not fully supported

License

MIT licensed. See LICENSE for details.

Release History

Release History

0.1.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
asyncwsgi-0.1.zip (5.3 kB) Copy SHA256 Checksum SHA256 Source Apr 26, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting