Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
parameters:
- name: location
in: path
description: The location of the exposure resource to summarise.
required: true
type: string
"""
logging.debug("Location: {}".format(location))
if location is None:
return jsonify({
'exposures': [ex for ex in map(_get_exposure_summary, sorted(os.listdir(settings.get('server', 'INPUTS_DATA_DIRECTORY')))) if ex]
})
else:
exposure = _get_exposure_summary('{}{}'.format(location, TAR_FILE_SUFFIX))
if not exposure:
return Response(status=http.HTTP_RESPONSE_RESOURCE_NOT_FOUND)
return jsonify({'exposures': [exposure]})
filepath = os.path.join(settings.get('server', 'OUTPUTS_DATA_DIRECTORY'), filename)
if not filepath.endswith(TAR_FILE_SUFFIX):
continue
if not os.path.isfile(filepath):
continue
os.remove(filepath)
response = Response(status=http.HTTP_RESPONSE_OK)
else:
filename = str(location) + TAR_FILE_SUFFIX
filepath = os.path.join(settings.get('server', 'OUTPUTS_DATA_DIRECTORY'), filename)
if not os.path.exists(filepath):
response = Response(status=http.HTTP_RESPONSE_RESOURCE_NOT_FOUND)
else:
os.remove(filepath)
response = Response(status=http.HTTP_RESPONSE_OK)
return response