Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_captions_and_video_info(self, data, suffix=''):
edx_video_id = data.get('edx_video_id')
try:
video = Video.objects.get(edx_video_id=edx_video_id)
except Video.DoesNotExist:
asset = None
else:
media_service = get_media_service_client(self.location.org)
asset = media_service.get_input_asset_by_video_id(edx_video_id, 'ENCODED')
error_message = _("Target Video is no longer available on Azure or is corrupted in some way.")
captions = []
video_info = {}
asset_files = None
if asset:
locator_on_demand = media_service.get_asset_locators(asset['Id'], LocatorTypes.OnDemandOrigin)
locator_sas = media_service.get_asset_locators(asset['Id'], LocatorTypes.SAS)
if locator_on_demand: