def guess_mimetype(resource_path):
"""
Guesses the mimetype of a given resource.
Args:
resource_path: the path to a given resource.
Returns:
The mimetype string.
"""
mime = mimetypes.guess_type(resource_path)[0]
if mime is None:
return "application/octet-stream"
return mime
评论列表
文章目录