|
1 | 1 | # pantomime |
2 | 2 |
|
3 | | -[](https://github.com/alephdata/pantomime/actions/workflows/build.yml) |
4 | | - |
5 | | -``pantomime`` is a small library that handles the parsing and normalisation |
6 | | -of internet MIME types in Python. This can be useful to normalise invalid, |
7 | | -or misformatted MIME types emitted by remote web servers. |
8 | | - |
9 | | -## Usage |
10 | | - |
11 | | -The simplest use is to normalise a MIME type: |
12 | | - |
13 | | -```python |
14 | | -from pantomime import normalize_mimetype |
15 | | - |
16 | | -assert normalize_mimetype('TEXT/PLAIN') == 'text/plain' |
17 | | -assert normalize_mimetype('plain/text') == 'text/plain' |
18 | | -assert normalize_mimetype(None) == 'application/octet-stream' |
19 | | -assert normalize_mimetype('') == 'application/octet-stream' |
20 | | -``` |
21 | | - |
22 | | -Internally, `pantomime` uses a `MIMEType` object to handle parsing. It can |
23 | | -be used to access more specific information, like human readable labels: |
24 | | - |
25 | | -```python |
26 | | -from pantomime import parse_mimetype |
27 | | - |
28 | | -parsed = parse_mimetype('text/plain') |
29 | | -assert parsed.family == 'text' |
30 | | -assert parsed.subtype == 'plain' |
31 | | -assert parsed.label == 'Plain text' |
32 | | -``` |
33 | | - |
34 | | -## Open issues |
35 | | - |
36 | | -* Internationalisation, i.e. make the human-readable labels available in |
37 | | - multiple languages. |
38 | | -* Expand replacements for specific MIME types. |
| 3 | +**NOTICE** The functionality contained in `pantomime` is now maintained as part of `rigour`, which combines data validation for several `followthemoney`-related data formats. See https://opensanctions.github.io/rigour/mime/ for details. |
39 | 4 |
|
40 | 5 | ## License |
41 | 6 |
|
42 | | -Licensed under MIT terms, see the ``LICENSE`` file included in this repository. |
| 7 | +Licensed under MIT terms, see the ``LICENSE`` file included in this repository. |
0 commit comments