Skip to main content

# Travis CI Build Status [![Build Status](https://travis-ci.org/dbtsai/python-mimeparse.svg?branch=master)](https://travis-ci.org/dbtsai/python-mimeparse)

This module provides basic functions for handling mime-types. It can handle matching mime-types against a list of media-ranges. See section 14.1 of the HTTP specification [RFC 2616] for a complete explanation.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1

Contents:
  • parse_mime_type(): Parses a mime-type into its component parts.

  • parse_media_range(): Media-ranges are mime-types with wild-cards and a “q” quality parameter.

  • quality(): Determines the quality (“q”) of a mime-type when compared against a list of media-ranges.

  • quality_parsed(): Just like quality() except the second parameter must be pre-parsed.

  • best_match(): Choose the mime-type with the highest quality (“q”) from a list of candidates.

Testing

The format of the JSON test data file is as follows: A top-level JSON object which has a key for each of the functions to be tested. The value corresponding to that key is a list of tests. Each test contains: the argument or arguments to the function being tested, the expected results and an optional description.

Python

The Python tests require Python 2.6.

Run the tests by typing: python mimeparse_test.py

To make sure that the package works in all the supported environments, you can run tox tests: pip install tox tox

Metadata

Release files for python-mimeparse 1.5.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-mimeparse 1.5.2
File Size Uploaded Provenance Actions
python-mimeparse-1.5.2.tar.gz 5.9 kB Without provenance Details for python-mimeparse-1.5.2.tar.gz

Release files / python-mimeparse-1.5.2.tar.gz

Download URL python-mimeparse-1.5.2.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
bef134a59598cc6aa598f84553162aa7a0c01f3f431588225bb9a208964b1827
BLAKE2b-256 checksum
How to use checksums
9cea148511af6f5a6889f4d3b90b00e817b4380658fd0def82a85ee83eddfa45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for python-mimeparse 1.5.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page