[New-bugs-announce] [issue40841] Implement mimetypes.sniff

Dong-hee Na report at bugs.python.org
Tue Jun 2 02:42:45 EDT 2020


New submission from Dong-hee Na <donghee.na92 at gmail.com>:

The current mimetypes.guess_type API guesses file types based on file extensions.

However, there is a more accurate method which is calling sniffing.

Some languages like Go(https://golang.org/pkg/net/http/#DetectContentType) provides mimesniff API and the method is implemented based on a standard way which is published on https://mimesniff.spec.whatwg.org/


I have a sample code implementation this
https://github.com/corona10/mimesniff/blob/master/mimesniff/mimesniff.py
But the API interface will be changed to mimetypes API.


So I would like to provide mimetypes.sniff API rather than a new stdlib package like mimesniff.

----------
components: Library (Lib)
messages: 370591
nosy: corona10, vstinner
priority: normal
severity: normal
status: open
title: Implement mimetypes.sniff
type: enhancement
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40841>
_______________________________________


More information about the New-bugs-announce mailing list