Files
edx-platform/cms/lib/spectacular.py
Kristin Aoki 9f734a7a5e feat: update youtube transcript fetch to allow all languages (#34436)
* feat: allow all languages

* feat: add youtube transcript import functions as drf
2024-03-29 08:28:18 -04:00

23 lines
972 B
Python

""" Helper functions for drf-spectacular """
def cms_api_filter(endpoints):
"""
At the moment, we are only enabling drf-spectacular for the CMS API.
Filter out endpoints that are not part of the CMS API.
"""
filtered = []
for (path, path_regex, method, callback) in endpoints:
# Add only paths to the list that are part of the CMS API
if (
# Don't just replace this with /v1 when switching to a later version of the CMS API.
# That would include some unintended endpoints.
path.startswith("/api/contentstore/v0/xblock") or
path.startswith("/api/contentstore/v0/videos") or
path.startswith("/api/contentstore/v0/video_transcripts") or
path.startswith("/api/contentstore/v0/file_assets") or
path.startswith("/api/contentstore/v0/youtube_transcripts")
):
filtered.append((path, path_regex, method, callback))
return filtered