Python Forum
Wsgiref with asyncio ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wsgiref with asyncio ?
#1
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()
likes this post
Reply


Messages In This Thread
Wsgiref with asyncio ? - by JohnnyCoffee - Oct-27-2022, 06:59 PM
RE: Wsgiref with asyncio ? - by wavic - Oct-28-2022, 11:17 AM
RE: Wsgiref with asyncio ? - by JohnnyCoffee - Oct-28-2022, 02:12 PM
RE: Wsgiref with asyncio ? - by wavic - Oct-28-2022, 02:59 PM
RE: Wsgiref with asyncio ? - by JohnnyCoffee - Oct-30-2022, 10:36 PM
RE: Wsgiref with asyncio ? - by wavic - Oct-31-2022, 02:50 AM
RE: Wsgiref with asyncio ? - by JohnnyCoffee - Oct-31-2022, 03:42 PM
RE: Wsgiref with asyncio ? - by wavic - Oct-31-2022, 03:47 PM
RE: Wsgiref with asyncio ? - by JohnnyCoffee - Nov-01-2022, 08:35 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020