Skip to content

Instantly share code, notes, and snippets.

@angeloped
Created February 8, 2021 21:34
Show Gist options
  • Save angeloped/f66ffde538ad4256f4bfe31089f4eccb to your computer and use it in GitHub Desktop.
Save angeloped/f66ffde538ad4256f4bfe31089f4eccb to your computer and use it in GitHub Desktop.
Get MIME with python-magic module.
import magic
def getmime(filename=None):
return magic.Magic(mime=True).from_file(filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment