A sorta familiar HTTP framework.
Project description
Responder: a familiar HTTP Service Framework for Python
Powered by Starlette. That async
declaration is optional.
View documentation.
This gets you a ASGI app, with a production static files server pre-installed, jinja2 templating (without additional imports), and a production webserver based on uvloop, serving up requests with gzip compression automatically.
Testimonials
"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
More Examples
See the documentation's feature tour for more details on features available in Responder.
Installing Responder
Install the stable release:
$ pipenv install responder
✨🍰✨
Or, install from the development branch:
$ pipenv install -e git+https://github.com/taoufik07/responder.git#egg=responder
Only Python 3.6+ is supported.
The Basic Idea
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.
- Setting
resp.content
sends back bytes. - Setting
resp.text
sends back unicode, while settingresp.html
sends back HTML. - Setting
resp.media
sends back JSON/YAML (.text
/.html
/.content
override this). - Case-insensitive
req.headers
dict (from Requests directly). resp.status_code
,req.method
,req.url
, and other familiar friends.
Ideas
- Flask-style route expression, with new capabilities -- all while using Python 3.6+'s new f-string syntax.
- I love Falcon's "every request and response is passed into to each view and mutated"
methodology, especially
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. - A built in testing client that uses the actual Requests you know and love.
- The ability to mount other WSGI apps easily.
- Automatic gzipped-responses.
- In addition to Falcon's
on_get
,on_post
, etc methods, Responder features anon_request
method, which gets called on every type of request, much like Requests. - A production static file server is built-in.
- Uvicorn built-in as a production web server. I would have chosen Gunicorn, but it doesn't run on Windows. Plus, Uvicorn serves well to protect against slowloris attacks, making nginx unnecessary in production.
- GraphQL support, via Graphene. The goal here is to have any GraphQL query exposable at any route, magically.
- Provide an official way to run webpack.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file responder-2.0.7.tar.gz
.
File metadata
- Download URL: responder-2.0.7.tar.gz
- Upload date:
- Size: 24.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23a8f4b0136f74c272d187eb888a16e0b3fe4434881abfb60efecb71d78f6934 |
|
MD5 | dee852040bb1782ff53251cb960142fe |
|
BLAKE2b-256 | 64c4422588bc0c3d85f575b6e34154b73d28061a2e5e96ce3f657a83e4a40c5f |
File details
Details for the file responder-2.0.7-py3-none-any.whl
.
File metadata
- Download URL: responder-2.0.7-py3-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8210d310c3b63a9f7e39d3daf5cf5cbdef152a5213ee2f10bba2b8b6c611a36a |
|
MD5 | add57b7b7e6fae87ac126ac15ac5a43a |
|
BLAKE2b-256 | 6854ba4b932a4efd92670ffa842afdcdbf266bc590e898239772ae4293a91908 |