content-types 🗃️🔎
A Python library to map file extensions to MIME types.
It also provides a CLI for quick lookups right from your terminal.
If no known mapping is found, the tool returns application/octet-stream.
Installation
uv pip install content-types
Usage
import content_types
# Forward lookup: filename -> MIME type
mime_type = content_types.get_content_type("example.jpg")
print(mime_type) # "image/jpeg"
# For very common files, you have shortcuts:
print(f'Content-Type for webp is {content_types.webp}') # 'image/webp'
CLI
After installing in a virtual environment or system-wide.
contenttypes example.jpg
# Outputs image/jpeg
Contributing
Contributions are welcome! Check out the GitHub repo for more details on how to get involved.
Metadata
Release files for content-types 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| content_types-0.2.0.tar.gz | 5.7 kB | Without provenance | Details for content_types-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| content_types-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for content_types-0.2.0-py3-none-any.whl |
Total release size: 10.4 kB
Release files / content_types-0.2.0.tar.gz
| Download URL | content_types-0.2.0.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e8bff69b76712095acfefdb76655bb29e32452ac4ebb5426747dce65b7f1909
|
|
BLAKE2b-256 checksum How to use checksums |
22c4834cf2d242c1e4f23874007ac2b9076f1d50b96f6c9799391f1e079e97be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.25
|
Release files / content_types-0.2.0-py3-none-any.whl
| Download URL | content_types-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2376d0cc7aff1040551132491745eb647ebbb1dfc9c2a167523452febe72cc46
|
|
BLAKE2b-256 checksum How to use checksums |
5706852d565086ce3b6c4fc540e0a099e71661c5f43820b0f1b0c7048ea69753
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.25
|
Security for content-types 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.