def _get_and_cache(file_path, supported_formats):
mime_type = from_file(file_path, mime=True)
try:
fmt = supported_formats[mime_type]
MagicCharacterizerMixin._cache[file_path] = fmt
return fmt
except KeyError:
message = '{0} characterized as {1} format, which is not supported'
message = message.format(file_path, mime_type)
raise UnsupportedFormat(message, http_status_code=500)
评论列表
文章目录