Quart

The Quart integration adds support for the Quart Web Framework. We support Quart versions 0.16.1 and higher.

Requires sentry-sdk ??? or higher.

A Python version of 3.7 or higher is also required.

Install

Install sentry-sdk from PyPI:

Copied
pip install --upgrade sentry-sdk

Configure

To configure the SDK, initialize it with the integration before or after your app has been initialized:

Copied
import sentry_sdk
from sentry_sdk.integrations.quart import QuartIntegration
from quart import Quart

sentry_sdk.init(
    dsn="https://examplePublicKey@o0.ingest.sentry.io/0",
    integrations=[
        QuartIntegration(),
    ],

    # Set traces_sample_rate to 1.0 to capture 100%
    # of transactions for performance monitoring.
    # We recommend adjusting this value in production,
    traces_sample_rate=1.0,
)

app = Quart(__name__)

Behavior

  • The Sentry Python SDK will install the Quart integration for all of your apps.

  • All exceptions leading to an Internal Server Error, from before/after serving functions, and background tasks are reported.

  • Request data is attached to all events: HTTP method, URL, headers. Sentry also excludes personally identifiable information (such as user IDs, usernames, cookies, authorization headers, IP addresses) unless you set send_default_pii to True.

  • Each request has a separate scope. Changes to the scope within a view, for example setting a tag, will only apply to events sent as part of the request being handled.

  • Logging with any logger will create breadcrumbs when the Logging integration is enabled (done by default).

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").