PyDocs

Nav

Internet Protocols and Support

SimpleHTTPRequestHandler.guess_type

  • SimpleHTTPRequestHandler.guess_type(path)
Guess the type of a file.

Argument is a PATH (a filename).

Return value is a string of the form type/subtype,
usable for a MIME Content-type header.

The default implementation looks the file's extension
up in the table self.extensions_map, using application/octet-stream
as a default; however it would be permissible (if
slow) to look inside the data to make a better guess.
Changed in 3.13
  • 3.13: Add mimetypes.guess_file_type() as a fallback.
0 Examples
No examples for http.server/SimpleHTTPRequestHandler.guess_type.
See Also
No see-alsos for http.server/SimpleHTTPRequestHandler.guess_type
0 Notes
No notes for SimpleHTTPRequestHandler.guess_type