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 5.3.2 of the HTTP 1.1 Semantics and Content specification [RFC 7231] for a complete explanation: https://tools.ietf.org/html/rfc7231#section-5.3.2
Installation
Use pip:
$ pip install python-mimeparse
It supports Python 3.8+ and PyPy.
Functions
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
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
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.
Metadata
Release files for python-mimeparse 2.0.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 |
|---|---|---|---|---|
| python_mimeparse-2.0.0.tar.gz | 7.2 kB | Without provenance | Details for python_mimeparse-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_mimeparse-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for python_mimeparse-2.0.0-py3-none-any.whl |
Total release size: 12.7 kB
Release files / python_mimeparse-2.0.0.tar.gz
| Download URL | python_mimeparse-2.0.0.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b9a9dcf7aa82465e31bd667f5cb7000604811dce83554f1c8a43693a32cb303
|
|
BLAKE2b-256 checksum How to use checksums |
cd85c40f2e0b2128905f6c34894be01803c114f2b2efab0e8b4c3dca5e56b999
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Release files / python_mimeparse-2.0.0-py3-none-any.whl
| Download URL | python_mimeparse-2.0.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
574062a06f2e1d416535c8d3b83ccc6ebe95941e74e2c5939fc010a12e37cc09
|
|
BLAKE2b-256 checksum How to use checksums |
65d91093a9d6d22d04d433003c96b9b1d46741b43fee5b11ece5098297737fce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Security for python-mimeparse 2.0.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.