Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing deprecated version attribute #2338

Merged
merged 11 commits into from
Sep 6, 2023
4 changes: 3 additions & 1 deletion sentry_sdk/integrations/flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from sentry_sdk.integrations import DidNotEnable, Integration
from sentry_sdk.integrations._wsgi_common import RequestExtractor
from sentry_sdk.integrations.wsgi import SentryWsgiMiddleware
from sentry_sdk.integrations.modules import _get_installed_modules
from sentry_sdk.scope import Scope
from sentry_sdk.tracing import SOURCE_FOR_STYLE
from sentry_sdk.utils import (
Expand All @@ -28,7 +29,6 @@

try:
from flask import Flask, Request # type: ignore
from flask import __version__ as FLASK_VERSION
from flask import request as flask_request
from flask.signals import (
before_render_template,
Expand Down Expand Up @@ -65,6 +65,8 @@ def __init__(self, transaction_style="endpoint"):
def setup_once():
# type: () -> None

installed_packages = _get_installed_modules()
FLASK_VERSION = installed_packages["flask"]
version = parse_version(FLASK_VERSION)

if version is None:
Expand Down