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