skillfed

mediatype

Media Type parsing and creation

mediatype v0.1.6 96.9K downloads/30d#13,185 on PyPI3
Permissive license MIT DORMANT released

What it is and what it does

mediatype is a lightweight library for parsing and constructing MIME types (also called media types or content types). It breaks down a media type string like 'application/manifest+json' into its structural components—type, subtype, suffix, and optional parameters—and can reconstruct the string from those components. The library follows RFC-6838 specifications and is useful anywhere HTTP content negotiation, file type handling, or protocol parsing requires reliable media type manipulation.

The package depends only on enumb and installs as a pure Python wheel, making it quick to add to any project. It supports Python 3.8 through 3.10. Because the last release was in April 2022 and the repository shows no recent activity, the package is stable but not actively developed; it is suitable for projects that need straightforward media type handling without expecting ongoing feature additions.

Use it for:

  • Parse Content-Type headers in HTTP request/response handlers to extract and validate media types.
  • Build or validate MIME type strings programmatically when constructing HTTP responses or file metadata.
  • Decompose media types in content negotiation logic to match client Accept headers against server capabilities.
  • Normalize or canonicalize media type strings in APIs or data pipelines that consume untrusted input.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Parses and creates MIME types (media types) according to RFC-6838, decomposing them into type, subtype, suffix, and parameters or reconstructing them from components.

Yes, if you need reliable MIME type parsing and don't require active maintenance. The package is stable, has no known vulnerabilities, and solves a narrow, well-defined problem with minimal dependencies. The dormant maintenance status is acceptable for a utility library with a stable specification (RFC-6838), but unsuitable if you need ongoing bug fixes or Python version support beyond 3.10.

Install

mediatype on PyPI

pip

pip install mediatype

uv

uv add mediatype

poetry

poetry add mediatype

Installing mediatype

Before you install

Low install friction; pure Python wheel with a single lightweight dependency (enumb). Maintenance is dormant—last release was 2022-04-12 and no commits since 2024-08-14, but the repository is not archived and the package remains functional for current Python versions.

License in practice

MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects.

Quickstart

pip install mediatype

import mediatype
media_type = mediatype.parse('application/manifest+json')
print(media_type.type, media_type.subtype, media_type.suffix)

Verify before relying

  • Whether the package handles all RFC-6838 edge cases (e.g., quoted parameters, charset encoding) or only common cases.
  • Performance characteristics when parsing large numbers of media types or complex parameter strings.
  • Whether enumb dependency is actively maintained and compatible with future Python releases.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.8,<4.0)
Install friction low — pure-Python wheel
Runtime dependencies 1 — enumb
Maintenance dormant — 1,585 days since the last release
Last repo commit
First released
Downloads 96,908/month — #13,185 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: mediatype-0.1.6-py3-none-any.whl

Keywords: python, mimetype, mediatype, contenttype, mime

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

mime type parsingmedia type handlingcontent-type parserrfc 6838 mimeparse content type headermime type creationmediatype library
mime-typehttp-headersrfc-6838

More WWW/HTTP packages