Skip to main content

Beautiful debugging page for Starlette apps.

Project description

Starception

Beautiful debugging page for Starlette apps. Look and feel inspired by Elixir Phoenix.

PyPI GitHub Workflow Status GitHub Libraries.io dependency status for latest release PyPI - Downloads GitHub Release Date Lines of code

Installation

Install starception using PIP or poetry:

pip install starception
# or
poetry add starception

Add it as the first middleware in to your app:

app = Starlette(
    middleware=[
        Middleware(StarceptionMiddleware, debug=True),
        # other middleware here
    ],
)

Note, the middleware won't handle anything if debug=False, instead it will display plain string "Internal Server Error". Also, I would recommend to add it only for local development, as such error page, when enabled on prod by mistake, can expose sensitive data.

Screenshot

image

Features

  • secrets masking
  • solution hints
  • code snippets
  • display request info: query, body, headers, cookies
  • session contents
  • request and app state
  • platform information
  • environment variables

The middleware will automatically mask any value which key contains key, secret, token, password.

Quick start

See example application in examples/ directory of this repository.

Solution hints

If exception class has solution attribute then its content will be used as a solution hint.

class WithHintError(Exception):
    solution = (
        'The connection to the database cannot be established. '
        'Either the database server is down or connection credentials are invalid.'
    )

image

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

starception-0.1.0.tar.gz (10.2 kB view hashes)

Uploaded Source

Built Distribution

starception-0.1.0-py3-none-any.whl (10.0 kB view hashes)

Uploaded Python 3

Supported by

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