def setup_once(): # type: () -> None try: version = tuple(map(int, FLASK_VERSION.split(".")[:3])) except (ValueError, TypeError): raise DidNotEnable( "Unparseable Flask version: {}".format(FLASK_VERSION)) if version < (0, 11): raise DidNotEnable("Flask 0.11 or newer is required.") appcontext_pushed.connect(_push_appctx) appcontext_tearing_down.connect(_pop_appctx) request_started.connect(_request_started) got_request_exception.connect(_capture_exception) old_app = Flask.__call__ def sentry_patched_wsgi_app(self, environ, start_response): # type: (Any, Dict[str, str], Callable[..., Any]) -> _ScopedResponse if Hub.current.get_integration(FlaskIntegration) is None: return old_app(self, environ, start_response) return SentryWsgiMiddleware( lambda *a, **kw: old_app(self, *a, **kw))(environ, start_response) Flask.__call__ = sentry_patched_wsgi_app # type: ignore
def install(self): appcontext_pushed.connect(_push_appctx) appcontext_tearing_down.connect(_pop_appctx) request_started.connect(_request_started) got_request_exception.connect(_capture_exception) old_app = Flask.__call__ def sentry_patched_wsgi_app(self, environ, start_response): return run_wsgi_app(lambda *a, **kw: old_app(self, *a, **kw), environ, start_response) Flask.__call__ = sentry_patched_wsgi_app
def setup_once(): appcontext_pushed.connect(_push_appctx) appcontext_tearing_down.connect(_pop_appctx) request_started.connect(_request_started) got_request_exception.connect(_capture_exception) old_app = Flask.__call__ def sentry_patched_wsgi_app(self, environ, start_response): if Hub.current.get_integration(FlaskIntegration) is None: return old_app(self, environ, start_response) return run_wsgi_app(lambda *a, **kw: old_app(self, *a, **kw), environ, start_response) Flask.__call__ = sentry_patched_wsgi_app
def setup_once(): # type: () -> None appcontext_pushed.connect(_push_appctx) appcontext_tearing_down.connect(_pop_appctx) request_started.connect(_request_started) got_request_exception.connect(_capture_exception) old_app = Flask.__call__ def sentry_patched_wsgi_app(self, environ, start_response): # type: (Any, Dict[str, str], Callable[..., Any]) -> _ScopedResponse if Hub.current.get_integration(FlaskIntegration) is None: return old_app(self, environ, start_response) return SentryWsgiMiddleware( lambda *a, **kw: old_app(self, *a, **kw))(environ, start_response) Flask.__call__ = sentry_patched_wsgi_app # type: ignore