Skip to main content

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.1
Filename, size File type Python version Upload date Hashes
Filename, size mimesniff-1.1.1-py3-none-any.whl (7.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size mimesniff-1.1.1.tar.gz (3.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page