Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Pure python mimesniff implementation of https://mimesniff.spec.whatwg.org

Project description

https://travis-ci.org/corona10/mimesniff.svg?branch=master https://img.shields.io/pypi/v/mimesniff.svg?style=flat

Pure python mimesniff implementation of https://mimesniff.spec.whatwg.org

API interface is similar with API of python standard library

Install

pip install mimesniff

Usage

import mimesniff

res = mimesniff.what('sample.mp3')
print(res)
# audio/mpeg
with open('sample.mp3', 'rb') as fin:
    res = mimesniff.what(fin)
    print(res)
    # audio/mpeg

with open('sample.mp3', 'rb') as fin:
    header = fin.read(512)
    res = mimesniff.what(header)
    print(res)
    # audio/mpeg

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for mimesniff, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size mimesniff-1.1.0-py3-none-any.whl (7.8 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page