pantomime


Namepantomime JSON
Version 0.6.1 PyPI version JSON
download
home_pagehttp://github.com/alephdata/pantomime
SummaryMIME type normalisation and labels.
upload_time2023-07-19 12:40:27
maintainer
docs_urlNone
authorJournalism Development Network, Inc.
requires_python
licenseMIT
keywords mime mimetypes file types
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            # pantomime

[![build](https://github.com/alephdata/pantomime/actions/workflows/build.yml/badge.svg)](https://github.com/alephdata/pantomime/actions/workflows/build.yml)

``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:

```python
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:

```python
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.

            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/alephdata/pantomime",
    "name": "pantomime",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "mime mimetypes file types",
    "author": "Journalism Development Network, Inc.",
    "author_email": "data@occrp.org",
    "download_url": "https://files.pythonhosted.org/packages/41/30/db94b1b569c2c0f95e4e2bbd87276daff769f5ad21b74fe3a682ab6628fd/pantomime-0.6.1.tar.gz",
    "platform": null,
    "description": "# pantomime\n\n[![build](https://github.com/alephdata/pantomime/actions/workflows/build.yml/badge.svg)](https://github.com/alephdata/pantomime/actions/workflows/build.yml)\n\n``pantomime`` is a small library that handles the parsing and normalisation\nof internet MIME types in Python. This can be useful to normalise invalid,\nor misformatted MIME types emitted by remote web servers.\n\n## Usage\n\nThe simplest use is to normalise a MIME type:\n\n```python\nfrom pantomime import normalize_mimetype\n\nassert normalize_mimetype('TEXT/PLAIN') == 'text/plain'\nassert normalize_mimetype('plain/text') == 'text/plain'\nassert normalize_mimetype(None) == 'application/octet-stream'\nassert normalize_mimetype('') == 'application/octet-stream'\n```\n\nInternally, `pantomime` uses a `MIMEType` object to handle parsing. It can\nbe used to access more specific information, like human readable labels:\n\n```python\nfrom pantomime import parse_mimetype\n\nparsed = parse_mimetype('text/plain')\nassert parsed.family == 'text'\nassert parsed.subtype == 'plain'\nassert parsed.label == 'Plain text'\n```\n\n## Open issues\n\n* Internationalisation, i.e. make the human-readable labels available in\n  multiple languages.\n* Expand replacements for specific MIME types.\n\n## License\n\nLicensed under MIT terms, see the ``LICENSE`` file included in this repository.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "MIME type normalisation and labels.",
    "version": "0.6.1",
    "project_urls": {
        "Homepage": "http://github.com/alephdata/pantomime"
    },
    "split_keywords": [
        "mime",
        "mimetypes",
        "file",
        "types"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9c8d96fcb5db774fbc253a8ec8364b9ee45270ea4bcc8b5cc230cee7a82eb058",
                "md5": "65c7cae24c079a3f025d08bc0ca12424",
                "sha256": "4ea567dffc2458a174cd624061a1a0efc081c858938d55291e4825e47a4fdb0f"
            },
            "downloads": -1,
            "filename": "pantomime-0.6.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "65c7cae24c079a3f025d08bc0ca12424",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 9402,
            "upload_time": "2023-07-19T12:40:26",
            "upload_time_iso_8601": "2023-07-19T12:40:26.605603Z",
            "url": "https://files.pythonhosted.org/packages/9c/8d/96fcb5db774fbc253a8ec8364b9ee45270ea4bcc8b5cc230cee7a82eb058/pantomime-0.6.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4130db94b1b569c2c0f95e4e2bbd87276daff769f5ad21b74fe3a682ab6628fd",
                "md5": "e1b7ad35cfd79e9a538e99bc1b0c0545",
                "sha256": "6ff211788ecfbe2cdf79bf8617d7e2347b9d734ce3dac983cafa9673ed099789"
            },
            "downloads": -1,
            "filename": "pantomime-0.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e1b7ad35cfd79e9a538e99bc1b0c0545",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7454,
            "upload_time": "2023-07-19T12:40:27",
            "upload_time_iso_8601": "2023-07-19T12:40:27.975549Z",
            "url": "https://files.pythonhosted.org/packages/41/30/db94b1b569c2c0f95e4e2bbd87276daff769f5ad21b74fe3a682ab6628fd/pantomime-0.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-19 12:40:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "alephdata",
    "github_project": "pantomime",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pantomime"
}
        
Elapsed time: 0.11921s