sbt-idp/cope2n-api/fwd_api/api_specs/hooks.py
2023-11-30 18:19:06 +07:00

11 lines
458 B
Python
Executable File

from django.conf import settings
EXCLUDE_PATH = settings.SPECTACULAR_SETTINGS["EXCLUDE_PATH"]
EXCLUDE_RELATIVE_PATH = settings.SPECTACULAR_SETTINGS["EXCLUDE_RELATIVE_PATH"]
def remove_apis_from_list(endpoints):
il = []
for (path, path_regex, method, callback) in endpoints:
if path not in EXCLUDE_PATH and all(r_path not in path for r_path in EXCLUDE_RELATIVE_PATH):
il.append((path, path_regex, method, callback))
return il