Let\'s say you want to save a bunch of files somewhere, for instance in BLOBs. Let\'s say you want to dish these files out via a web page and have the client automatically o
2017 Update
No need to go to github, it is on PyPi under a different name:
pip3 install --user python-magic # or: sudo apt install python3-magic # Ubuntu distro package
The code can be simplified as well:
>>> import magic >>> magic.from_file('/tmp/img_3304.jpg', mime=True) 'image/jpeg'