def __init__(self, data, s3tree): # public attributes self.path = data.get("Key") self.etag = data.get("ETag") self.last_modified = data.get("LastModified") self.size_in_bytes = data.get("Size") self.storage_class = data.get("StorageClass") # create a mime object for this file self.mime = mimelib.url(self.path) # private attributes self.__s3tree = s3tree
def get_mime_type(file_path): mime_type = mimelib.url(file_path).mime_type mime_type = mime_type if mime_type else "text/plain" return mime_type
def test_url(): assert url("https://example.com/foo.csv").is_text is True
def get_mime_type(file_path): if file_path.endswith(".mkv"): return "video/x-matroska" mime_type = mimelib.url(file_path).mime_type mime_type = mime_type if mime_type else "text/plain" return mime_type