diff --git a/pyproject.toml b/pyproject.toml index e0973c6..68eb801 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,6 +19,7 @@ license = {text = "GPLv3"} [project.optional-dependencies] prod = [ "gunicorn>=20.1.0", + "sentry-sdk>=1.40.5", ] [tool] diff --git a/src/nvdb/__init__.py b/src/nvdb/__init__.py index 1c7c3de..bdc3bff 100644 --- a/src/nvdb/__init__.py +++ b/src/nvdb/__init__.py @@ -1,3 +1,5 @@ +import os + URL = "https://nvdbapiles-v3.atlas.vegvesen.no/" mapping = str.maketrans( @@ -24,3 +26,11 @@ def normalize(value): if value[0] in "0123456789": value = "_" + value return value + + +if os.getenv('SENTRY_DSN'): + import sentry_sdk + sentry_sdk.init( + dsn=os.getenv('SENTRY_DSN'), + ) + print('sentry ready')