Oct-27-2022, 06:59 PM
I'm wanting to relate the asyncio module with wsgiref to work with asynchronous requests could anyone give me an idea of a functional implementation ?
import asyncio from wsgiref.simple_server import make_server def hello_world_app(environ, start_response): status = "200 OK" # HTTP Status headers = [("Content-type", "text/plain; charset=utf-8")] # HTTP Headers start_response(status, headers) # The returned object is going to be printed return [b"Hello World"] with make_server("", 8000, hello_world_app) as httpd: print("Serving on port 8000...") # Serve until process is killed httpd.serve_forever()