From 215e3c2fc0453122b5fefcc7fe39f14797bee17f Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Fri, 1 Dec 2023 12:35:37 +0100 Subject: init: filter out GET /scopes/status requests ogcp.js calls this endpoint very often, which send a request to the ogserver through the REST API. This call is needed because javascript code cannot directly talk to the ogserver since it does not know what the API_KEY is. Add a filter to skip log GET /scopes/status requests. Thanks to DaniGM for helping with this. --- ogcp/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ogcp') diff --git a/ogcp/__init__.py b/ogcp/__init__.py index 58de9a4..a468101 100644 --- a/ogcp/__init__.py +++ b/ogcp/__init__.py @@ -17,6 +17,12 @@ app = Flask(__name__) app.config.from_json(ogcp_cfg_path) app.secret_key = urandom(16) +class NoScopeStatus(logging.Filter): + def filter(self, record): + return 'GET /scopes/status' not in record.getMessage() + +logging.getLogger("werkzeug").addFilter(NoScopeStatus()) + babel = Babel(app) csrf = CSRFProtect(app) bootstrap = Bootstrap(app) -- cgit v1.2.3-18-g5258