from gevent import monkey; monkey.patch_all()
from flask import render_template
from flask import Response
from app import app
import urllib2

def fetch_url(url):
   response = urllib2.urlopen('http://python.org/'
   html = response.read()

@app.route("/test")
def test():
    jt=gevent.spawn(fetch_url)
    jt.join()
    return "Hello World"


Or do I have to


@app.route("/test")
def test():
    jt=gevent.spawn(fetch_url)
    jt.join()

        def generate():
              yield "hello world"
        return Response(generate())


I would like the call to the urllib2 to by async
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to