The Flask integration adds support for the Flask Web Framework.
sentry-sdkfrom PyPI with the
$ pip install --upgrade sentry-sdk[flask]==0.4.3
To configure the SDK, initialize it with the integration before or after your app has been initialized:
import sentry_sdk from sentry_sdk.integrations.flask import FlaskIntegration sentry_sdk.init( dsn="___PUBLIC_DSN___", integrations=[FlaskIntegration()] ) app = Flask(__name__)
The Flask integration will be installed for all of your apps. It hooks into Flask’s signals, not anything on the app object.
A bit of data is attached to each event:
Personally identifiable information (such as user ids, usernames, cookies, authorization headers, ip addresses) is excluded unless
send_default_piiis set to
Request data is attached to all events.
If you have Flask-Login installed and configured, user data is attached to the event.
All exceptions leading to a Internal Server Error are reported.
app.loggeror really any logger will create breadcrumbs when the Logging integration is enabled (done by default).
The user feedback feature can be used with this integration. For more information see User Feedback.