This repository has been archived by the owner on Dec 24, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
jleclanche/python-mime
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
python-mime - A proper MIME type library for Python python-mime implements platform-specific MIME parsing. So far, only the xdg implementation is fully supported. There is a minimal windows (winreg-based) implementation. Usage: >>> import mime >>> m = mime.MimeType("image/jpeg") >>> m.comment() u'JPEG image' >>> m.aliases() [u'image/pjpeg'] It is possible to query MIME types by file name (name-based matching) >>> mime.MimeType.fromName('myfile.png') <MimeType: image/png> It is also possible to query it by file content with MimeType.fromContent, although this is not fully implemented. XDG-based MIME types support MIME Actions. >>> m.associations() ['qiviewer.desktop', 'firefox.desktop', 'wine-extension-jfif.desktop', 'wine-extension-jpe.desktop'] It is also possible to query the default application associated with a MIME type with defaultApplication(). There is not always a default application associated with a MIME type. In order to get the most appropriate application to open a MIME type with, do: >>> mime.MimeType.fromName("file.html").bestApplication() 'google-chrome.desktop'
About
Python implementation of the shared-mime-info XDG spec
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published