Skip to content

Commit

Permalink
Fixing deprecated version attribute (#2338)
Browse files Browse the repository at this point in the history

---------

Co-authored-by: Ivana Kellyerova <[email protected]>
  • Loading branch information
vagi8 and sentrivana committed Sep 18, 2023
1 parent 67dd529 commit 597c59e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions 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,10 +65,12 @@ def __init__(self, transaction_style="endpoint"):
def setup_once():
# type: () -> None

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

if version is None:
raise DidNotEnable("Unparsable Flask version: {}".format(FLASK_VERSION))
raise DidNotEnable("Unparsable Flask version: {}".format(flask_version))

if version < (0, 10):
raise DidNotEnable("Flask 0.10 or newer is required.")
Expand Down

0 comments on commit 597c59e

Please sign in to comment.