Skip to content
This repository was archived by the owner on Jun 13, 2023. It is now read-only.

Commit 3eca14a

Browse files
authored
fix(flask.py): ignore endpoints correctly (#340)
* fix(flask.py): ignore endpoints correctly with commonlib * fix(flask.py): lint - line too long Co-authored-by: ronnathaniel <ronnathaniel>
1 parent c733326 commit 3eca14a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

epsagon/wrappers/flask.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
from epsagon.common import EpsagonWarning
1515
from epsagon.utils import collect_container_metadata,\
1616
get_traceback_data_from_exception
17-
from ..http_filters import ignore_request
17+
from ..http_filters import ignore_request, \
18+
is_ignored_endpoint, add_ignored_endpoints
1819

1920

2021
class FlaskWrapper(object):
@@ -34,9 +35,11 @@ def __init__(self, app, ignored_endpoints=None):
3435
return
3536
setattr(app, self.EPSAGON_MARKER, True)
3637
self.app = app
37-
self.ignored_endpoints = []
3838
if ignored_endpoints:
39-
self.ignored_endpoints = ignored_endpoints
39+
if isinstance(ignored_endpoints, list):
40+
add_ignored_endpoints(ignored_endpoints)
41+
elif isinstance(ignored_endpoints, str):
42+
add_ignored_endpoints([ignored_endpoints])
4043

4144
# Override request handling.
4245
self.app.before_request(self._before_request)
@@ -134,7 +137,7 @@ def _teardown_request(self, exception):
134137
# Ignoring endpoint, only if no error happened.
135138
if (not exception and
136139
request.url_rule and
137-
request.url_rule.rule in self.ignored_endpoints
140+
is_ignored_endpoint(request.url_rule.rule)
138141
):
139142
return
140143

0 commit comments

Comments
 (0)