Skip to main content

A familiar HTTP Service Framework for Python.

Project description

Responder: a familiar HTTP Service Framework for Python

ci-tests ci-docs Documentation Status version license python-versions downloads contributors status

responder-synopsis

Responder is powered by Starlette. View documentation.

Responder gets you an ASGI app, with a production static files server pre-installed, Jinja templating, and a production webserver based on uvloop, automatically serving up requests with gzip compression. The async declaration within the example program is optional.

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 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:

  • graphql: Adds GraphQL support via Graphene
  • openapi: Adds OpenAPI/Swagger interface support

Install package with CLI and GraphQL support:

uv pip install --upgrade 'responder[cli,graphql]'

Alternatively, install directly from the repository:

pip install 'responder[full] @ git+https://github.com/kennethreitz/responder.git'

Responder supports Python 3.7+.

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 setting resp.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 an on_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.

Development

See Development Sandbox.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

responder-3.0.0.dev0.tar.gz (43.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

responder-3.0.0.dev0-py3-none-any.whl (34.4 kB view details)

Uploaded Python 3

File details

Details for the file responder-3.0.0.dev0.tar.gz.

File metadata

  • Download URL: responder-3.0.0.dev0.tar.gz
  • Upload date:
  • Size: 43.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.16

File hashes

Hashes for responder-3.0.0.dev0.tar.gz
Algorithm Hash digest
SHA256 0c923fc925c7638687f2a0f1345795414db185fe785fb2789d9e79b2e536068e
MD5 59264a94cfdf1844a79a8069c861b1a0
BLAKE2b-256 2b18d9a2a9deaf0d42e23f86f278e4f100ae88256cd50deb4bacf5f7c14378f3

See more details on using hashes here.

File details

Details for the file responder-3.0.0.dev0-py3-none-any.whl.

File metadata

  • Download URL: responder-3.0.0.dev0-py3-none-any.whl
  • Upload date:
  • Size: 34.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.16

File hashes

Hashes for responder-3.0.0.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 70145d3c1128902a7c2473858170e7902c45535ec1c08cbc3537b4757ca48486
MD5 b2a568123e05488a645161b7b3a3a89f
BLAKE2b-256 8b8579f65d0c60aff02b5e377422cdd26a84d650195c7b4c504ba8e62c823a2c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page