API Reference

content-types is intentionally tiny: a single lookup function, the mapping table behind it, and a handful of precomputed shortcut constants for the most common formats.

Lookup

The one entry point — map a filename, bare extension, Path, or URL to its MIME / content type.

get_content_type()

Given a filename (or just an extension), return the most specific,

Mapping data

The underlying extension -> content-type table (364 entries; keys have no leading dot).

EXTENSION_TO_CONTENT_TYPE

dict() -> new empty dictionary

Shortcut constants

Precomputed content types for very common formats, exposed as module-level attributes.

webp

str(object=’’) -> str

png

str(object=’’) -> str

jpg

str(object=’’) -> str

mp3

str(object=’’) -> str

json

str(object=’’) -> str

pdf

str(object=’’) -> str

zip

str(object=’’) -> str

xml

str(object=’’) -> str

csv

str(object=’’) -> str

md

str(object=’’) -> str

parquet

str(object=’’) -> str

ipynb

str(object=’’) -> str

pkl

str(object=’’) -> str

yaml

str(object=’’) -> str

toml

str(object=’’) -> str

sqlite

str(object=’’) -> str