pantomime
pantomime is a small library that handles the parsing and normalisation
of internet MIME types in Python. This can be useful to normalise invalid,
or misformatted MIME types emitted by remote web servers.
Usage
The simplest use is to normalise a MIME type:
from pantomime import normalize_mimetype
assert normalize_mimetype('TEXT/PLAIN') == 'text/plain'
assert normalize_mimetype('plain/text') == 'text/plain'
assert normalize_mimetype(None) == 'application/octet-stream'
assert normalize_mimetype('') == 'application/octet-stream'
Internally, pantomime uses a MIMEType object to handle parsing. It can
be used to access more specific information, like human readable labels:
from pantomime import parse_mimetype
parsed = parse_mimetype('text/plain')
assert parsed.family == 'text'
assert parsed.subtype == 'plain'
assert parsed.label == 'Plain text'
Open issues
- Internationalisation, i.e. make the human-readable labels available in multiple languages.
- Expand replacements for specific MIME types.
License
Licensed under MIT terms, see the LICENSE file included in this repository.
Metadata
Release files for pantomime 0.6.1
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 |
|---|---|---|---|---|
| pantomime-0.6.1.tar.gz | 7.5 kB | Without provenance | Details for pantomime-0.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pantomime-0.6.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for pantomime-0.6.1-py2.py3-none-any.whl |
Total release size: 16.9 kB
Release files / pantomime-0.6.1.tar.gz
| Download URL | pantomime-0.6.1.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ff211788ecfbe2cdf79bf8617d7e2347b9d734ce3dac983cafa9673ed099789
|
|
BLAKE2b-256 checksum How to use checksums |
4130db94b1b569c2c0f95e4e2bbd87276daff769f5ad21b74fe3a682ab6628fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Release files / pantomime-0.6.1-py2.py3-none-any.whl
| Download URL | pantomime-0.6.1-py2.py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
4ea567dffc2458a174cd624061a1a0efc081c858938d55291e4825e47a4fdb0f
|
|
BLAKE2b-256 checksum How to use checksums |
9c8d96fcb5db774fbc253a8ec8364b9ee45270ea4bcc8b5cc230cee7a82eb058
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Security for pantomime 0.6.1
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.