[issue40841] Provide mimetypes.sniff API as stdlib

2020-10-23 Thread Dong-hee Na
Dong-hee Na added the comment: @gvanrossum, @taleinat I've already provided the mimesniffing through PyPI ;) https://pypi.org/project/mimesniff/ The interface is similar to imghdr.what :) -- ___ Python tracker

[issue40841] Provide mimetypes.sniff API as stdlib

2020-10-23 Thread Tal Einat
Tal Einat added the comment: > Dong-hee, I recommend that you turn this into a 3rd party package on PyPI > yourself. +1 -- ___ Python tracker ___

[issue40841] Provide mimetypes.sniff API as stdlib

2020-10-23 Thread Guido van Rossum
Guido van Rossum added the comment: Dong-hee, I recommend that you turn this into a 3rd party package on PyPI yourself. That way your effort and code will live on! -- ___ Python tracker

[issue40841] Provide mimetypes.sniff API as stdlib

2020-10-23 Thread Dong-hee Na
Dong-hee Na added the comment: I close this issue as rejected! During the sprint, I could hear a lot of opinions from core devs including Guido, Tal, and Christian. The overall conclusion for me is not to add this time. if the mimetypes module is extracted from stdlib to pypi package, we

[issue40841] Provide mimetypes.sniff API as stdlib

2020-07-30 Thread Dong-hee Na
Dong-hee Na added the comment: https://www.garykessler.net/library/file_sigs.html looks like a good resource for this kind of API. However, I would like to choose well-known standard from whatwg or w3c etc.. -- ___ Python tracker

[issue40841] Provide mimetypes.sniff API as stdlib

2020-07-29 Thread YoSTEALTH
YoSTEALTH added the comment: Start and end position of the signature must be accounted for, not all file signature start at ``0`` or ``< 512`` bytes Rather then writing all the signatures manually might be a good idea to use already collected resource like

[issue40841] Provide mimetypes.sniff API as stdlib

2020-07-28 Thread Guido van Rossum
Guido van Rossum added the comment: When the standard says "trust the filename" it is talking to the application, not to the sniffing library. The library should provide the tool for applications to follow the standard, but I don't see a reason why we would have to enforce how applications

[issue40841] Provide mimetypes.sniff API as stdlib

2020-07-28 Thread Dong-hee Na
Dong-hee Na added the comment: > I think that both functions for detecting file type, by name and by content I think so too, mime sniffing would not be a way to alternate the method based on the file extension. Both APIs should be provided. > should not we add also the code for detecting

[issue40841] Provide mimetypes.sniff API as stdlib

2020-07-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think that both functions for detecting file type, by name and by content, are useful in different circumstances. We have similar more specific detection functions sndhdr and imghdr. But I am not sure whether it should be a part of the mimetypes module

[issue40841] Provide mimetypes.sniff API as stdlib

2020-07-27 Thread Jim Jewett
Jim Jewett added the comment: There are a zillion reasons a filename could be wrong -- but the standard says to trust the filesystem. So if it sniffs based on contents, it isn't quite following the standard. It is probably still a useful tool, but it won't be the One Right Way, and it isn't

[issue40841] Provide mimetypes.sniff API as stdlib

2020-07-27 Thread Guido van Rossum
Guido van Rossum added the comment: Whether the data was retrieved over a network has nothing to do with it. There are complementary ways of guessing what data you are working with -- guess based on the filename extension or sniff based on the contents of the file (or downloaded data).

[issue40841] Provide mimetypes.sniff API as stdlib

2020-07-27 Thread Jim Jewett
Jim Jewett added the comment: The standard itself says that it only applies to content served over http; if the content is retrieved by ftp or from a file system, then you should trust that. I don't notice that in the code you pointed to. So maybe filetype is the right answer if the data

[issue40841] Provide mimetypes.sniff API as stdlib

2020-07-27 Thread Dong-hee Na
Dong-hee Na added the comment: > This looks like a useful addition. I hope someone will take up the review! Thank you guido! I also think that this API is good to be added to the standard library and it would be very useful! I hope that someone would like to interest in this issue ;)

[issue40841] Provide mimetypes.sniff API as stdlib

2020-07-23 Thread Guido van Rossum
Guido van Rossum added the comment: This looks like a useful addition. I hope someone will take up the review! -- nosy: +gvanrossum ___ Python tracker ___

[issue40841] Provide mimetypes.sniff API as stdlib

2020-06-08 Thread Dong-hee Na
Change by Dong-hee Na : -- keywords: +patch pull_requests: +19929 stage: -> patch review pull_request: https://github.com/python/cpython/pull/20720 ___ Python tracker ___

[issue40841] Provide mimetypes.sniff API as stdlib

2020-06-02 Thread Dong-hee Na
Dong-hee Na added the comment: I ping some of the core developers who recently work on this module. Sorry if this topic is not interesting to you :( I want to listen to how about provide this API as the stdlib API. Three things I'd like to appeal through this proposal. 1. It will provide

[issue40841] Provide mimetypes.sniff API as stdlib

2020-06-02 Thread STINNER Victor
Change by STINNER Victor : -- nosy: -vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40841] Provide mimetypes.sniff API as stdlib

2020-06-02 Thread Dong-hee Na
Change by Dong-hee Na : -- title: Provide mimetypes.sniff API -> Provide mimetypes.sniff API as stdlib ___ Python tracker ___ ___