responder
A familiar HTTP Service Framework for Python.
Responder is a Python library for building web services and APIs. If you have written Python web code with Flask, the style will feel familiar: you define URL routes using decorators, and each route points to a function that handles the incoming request and builds the response. Responder runs on top of Starlette, a modern async web foundation, but keeps the surface simple enough that a minimal working server fits in about ten lines of code.
Installing it is a single pip command, and it requires Python 3.10 or newer. Sending back different types of responses is straightforward: you set resp.text for plain text, resp.html for HTML markup, resp.media for JSON data, or resp.file to stream a file. Reading incoming data is equally direct, with req.headers, req.params, and an awaitable req.media() for request bodies.
Beyond the basics, the library includes quite a few built-in capabilities. You can define before-request hooks to check authentication or enforce rate limits, write custom error handlers for specific exception types, accept WebSocket connections, and run background tasks without blocking the response. It also supports GraphQL out of the box through an optional integration, and you can mount existing Flask or other WSGI applications inside a Responder app if you need to mix old and new code.
Other included features are OpenAPI documentation generation, cookie-based sessions, gzip response compression, static file serving, and Jinja2 HTML templates. The production server is uvicorn, which is a fast async server. Route parameters can be typed so that a segment declared as int is automatically converted before reaching your function.
The full documentation is at responder.kennethreitz.org.