Pure Python Mimesniff Implementation of HTTPS://mimesniff.spec.whatwg.org
mimesniff的Python项目详细描述
纯python mimesniff实现 https://mimesniff.spec.whatwg.org
api接口类似于API of python standard library
安装
pip install mimesniff
用法
importmimesniffres=mimesniff.what('sample.mp3')print(res)# audio/mpegwithopen('sample.mp3','rb')asfin:res=mimesniff.what(fin)print(res)# audio/mpegwithopen('sample.mp3','rb')asfin:header=fin.read(512)res=mimesniff.what(header)print(res)# audio/mpeg