mimetypes.read_mime_types()

mimetypes.read_mime_types(filename) Load the type map given in the file filename, if it exists. The type map is returned as a dictionary mapping filename extensions, including the leading dot ('.'), to strings of the form 'type/subtype'. If the file filename does not exist or cannot be read, None is returned.

mimetypes.MimeTypes.types_map_inv

MimeTypes.types_map_inv Tuple containing two dictionaries, mapping MIME types to a list of filename extensions: the first dictionary is for the non-standards types and the second one is for the standard types. They are initialized by common_types and types_map.

mimetypes.MimeTypes.types_map

MimeTypes.types_map Tuple containing two dictionaries, mapping filename extensions to MIME types: the first dictionary is for the non-standards types and the second one is for the standard types. They are initialized by common_types and types_map.

mimetypes.MimeTypes.suffix_map

MimeTypes.suffix_map Dictionary mapping suffixes to suffixes. This is used to allow recognition of encoded files for which the encoding and the type are indicated by the same extension. For example, the .tgz extension is mapped to .tar.gz to allow the encoding and type to be recognized separately. This is initially a copy of the global suffix_map defined in the module.

mimetypes.MimeTypes.read_windows_registry()

MimeTypes.read_windows_registry(strict=True) Load MIME type information from the Windows registry. Availability: Windows. If strict is True, information will be added to the list of standard types, else to the list of non-standard types. New in version 3.2.

mimetypes.MimeTypes.readfp()

MimeTypes.readfp(fp, strict=True) Load MIME type information from an open file fp. The file must have the format of the standard mime.types files. If strict is True, information will be added to the list of standard types, else to the list of non-standard types.

mimetypes.MimeTypes.read()

MimeTypes.read(filename, strict=True) Load MIME information from a file named filename. This uses readfp() to parse the file. If strict is True, information will be added to list of standard types, else to the list of non-standard types.

mimetypes.MimeTypes.guess_type()

MimeTypes.guess_type(url, strict=True) Similar to the guess_type() function, using the tables stored as part of the object.

mimetypes.MimeTypes.guess_extension()

MimeTypes.guess_extension(type, strict=True) Similar to the guess_extension() function, using the tables stored as part of the object.

mimetypes.MimeTypes.guess_all_extensions()

MimeTypes.guess_all_extensions(type, strict=True) Similar to the guess_all_extensions() function, using the tables stored as part of the object.