Powered by Starlette. That async
declaration is optional.
View documentation.
This gets you a ASGI app, with a production static files server pre-installed, Jinja templating (without additional imports), and a production webserver based on uvloop, serving up requests with gzip compression automatically.
"Pleasantly very taken with python-responder. @kennethreitz at his absolute best." —Rudraksh M.K.
"ASGI is going to enable all sorts of new high-performance web services. It's awesome to see Responder starting to take advantage of that." — Tom Christie author of Django REST Framework
"I love that you are exploring new patterns. Go go go!" — Danny Greenfield, author of Two Scoops of Django
See the documentation's feature tour for more details on features available in Responder.
Install the most recent stable release:
pip install --upgrade 'responder'
Include support for all extensions and interfaces:
pip install --upgrade 'responder[full]'
Individual optional installation extras are:
Or, install directly from the repository:
pip install 'responder[full] @ git+https://github.com/kennethreitz/responder.git'
Responder supports Python 3.6+.
The primary concept here is to bring the niceties that are brought forth from both Flask and Falcon and unify them into a single framework, along with some new ideas I have. I also wanted to take some of the API primitives that are instilled in the Requests library and put them into a web framework. So, you'll find a lot of parallels here with Requests.
resp.content
sends back bytes.resp.text
sends back unicode, while setting resp.html
sends back HTML.resp.media
sends back JSON/YAML (.text
/.html
/.content
override this).req.headers
dict (from Requests directly).resp.status_code
, req.method
, req.url
, and other familiar friends.response.media
, and have used it here. In addition to
supporting JSON, I have decided to support YAML as well, as Kubernetes is slowly
taking over the world, and it uses YAML for all the things. Content-negotiation and
all that.on_get
, on_post
, etc methods, Responder features an
on_request
method, which gets called on every type of request, much like Requests.See Development Sandbox.