Email or username:

Password:

Forgot your password?
Johannes Ernst

Looking for a simple Python Http/2 server, for #feditest. Not an entire framework, that would be overkill and confusing. Does such a thing exist? Or does everyone expect that #python apps serve the web via WSGI?

8 comments
DopeGhoti

@J12t
The http.server package might fit the bill.

import http.server
import socketserver
PORT = 8080

Handler = http.server.SimpleHTTPRequestHandler
with socketserver.TCPServer( ("", PORT), Handler) as httpd:
print( "Serving on port", PORT )
httpd.serve_forever()
Johannes Ernst

@DopeGhoti does it speak http 2? I could see anything about that in docs.

DopeGhoti

@J12t the --protocol argument should allow you to set it. I'm constrained to my work environment right now so can't test to verify that you can use --protocol HTTP/2.0 as well as 1.0 and 1.1.

meejah

@J12t Twisted Web does HTTP2 (with Hyper).

gram

@J12t

Hypercorn supports HTTP/2 with h2 and asyncio with ASGI:

github.com/pgjones/hypercorn/

Go Up