Exemplo n.º 1
0
    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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
def test_url():
    assert url("https://example.com/foo.csv").is_text is True
Exemplo n.º 4
0
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