Flask-Sentry
Sentry and Spotlight integration for Flask.
- Configure and initialize Sentry SDK for Flask and the browser
- Spotlight integration
- Properly handle debug mode
Installation
pip install flask-sentry
Usage
from flask import app
from flask_sentry import Sentry
app = Flask(__name__)
Sentry(app, dsn="http://DSN")
Use init_sentry() in your template:
<!DOCTYPE html>
<html>
<head>
{{ init_sentry() }}
</head>
</html>
Using spotlight
Install spotlight:
npm install @spotlightjs/spotlight
Run spotlight before starting your app:
flask spotlight
Include the spotlight init script in your template, either using init_sentry() or only spotlight using init_spotlight().
<!DOCTYPE html>
<html>
<head>
{{ init_spotlight() }}
</head>
</html>
Will only render something if spotlight is enabled.
Spotlight is automatically enabled in debug mode when a spotlight server is detected. Otherwise, spotlight is disabled.
Configuration
| Config key | Extension argument | Description | Default |
|---|---|---|---|
| SENTRY_DSN | dsn | Sentry DSN | |
| SENTRY_* | **kwargs | Any options available in the sentry_sdk.init() function | |
| SENTRY_DEBUG_ENABLED | debug_enabled | Whether to enable sending to the dsn in debug | False |
| SPOTLIGHT_URL | spotlight_url | True or a spotlight url to enable spotlight | True |
| SPOTLIGHT_DETECT | detect_spotlight | Whether to detect if the spotlight sidecar is running before enabling spotlight | True |
| SPOTLIGHT_CMD | spotlight_cmd | The spotlight cmd to launch the sidecar | npx @spotlightjs/spotlight |
| SPOTLIGHT_SCRIPT | spotlight_script | The spotlight script in the browser | Currently recommended url |
| SENTRY_BROWSER | browser | Whether to enable sentry sdk in the browser | True |
| SENTRY_BROWSER_OPTIONS | browser_options | Options for the browser sdk | {} |
| SENTRY_BROWSER_TRACING | browser_tracing | Whether to enable tracing in the browser | True |
| SENTRY_BROWSER_REPLAY | browser_replay | Whether to enable session replay in the browser | True |
| SENTRY_BROWSER_SCRIPT | browser_script | Sentry sdk script url (do not load script if None) | Currently recommended url |
| SENTRY_BROWSER_SCRIPT_INTEGRITY | browser_script_integrity | Integrity hash for the sdk script | Hash for currently recommended url |
Metadata
Release files for flask-sentry 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flask_sentry-0.2.0.tar.gz | 3.7 kB | Without provenance | Details for flask_sentry-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flask_sentry-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for flask_sentry-0.2.0-py3-none-any.whl |
Total release size: 8.2 kB
Release files / flask_sentry-0.2.0.tar.gz
| Download URL | flask_sentry-0.2.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
46575761af40a48db55eab71675097eecd5a49f33a398c49cb3741c44d5fb800
|
|
BLAKE2b-256 checksum How to use checksums |
3e04115fc6adc881e13d078ff9c102c7b666bd4dfed165978d66bda18fab07d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.0
|
Release files / flask_sentry-0.2.0-py3-none-any.whl
| Download URL | flask_sentry-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
50c45f726eabbaf2010b81a78ae1c70f8fbfebb453432856fced0e18d8e9a745
|
|
BLAKE2b-256 checksum How to use checksums |
bb0be768332f13c5b5e2823799f61bdce8aa46a4f860dd3f59cb823eb7eacca4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.0
|
Security for flask-sentry 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.