I wanted to use my favorite python web framework with asyncio, so I ported 
Flask:

https://github.com/mrdon/flask

It looks like this [1]:

----

from asyncio import coroutine, sleep
from flask import Flask, request

app = Flask(__name__)
app.config['DEBUG'] = True

@app.route("/hello/<string:
name>")
@coroutine
def say_hi(name):
    yield from sleep(2)
    return "it worked %s" % request.args.get("name", name)

app.run()

-----

Given that it liters asyncio calls and "yield from" all over the place, I 
don't imagine it should go in flask master, but if anyone wants to try out 
asyncio but start somewhere familiar, it may be useful.

Don

[1] https://github.com/mrdon/flask/blob/master/hello.py

Reply via email to