python-mimeparse


Namepython-mimeparse JSON
Version 2.0.0 PyPI version JSON
download
home_pageNone
SummaryA module provides basic functions for parsing mime-type names and matching them against a list of media-ranges.
upload_time2024-08-25 13:38:14
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords mime-type media-type
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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**:

.. code-block:: sh

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

.. code-block:: sh

    $ 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.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "python-mimeparse",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Falconry team <mail@kgriffs.com>",
    "keywords": "mime-type, media-type",
    "author": null,
    "author_email": "Joe Gregorio <joe@bitworking.org>, DB Tsai <dbtsai@dbtsai.com>",
    "download_url": "https://files.pythonhosted.org/packages/cd/85/c40f2e0b2128905f6c34894be01803c114f2b2efab0e8b4c3dca5e56b999/python_mimeparse-2.0.0.tar.gz",
    "platform": null,
    "description": "Python-MimeParse\n================\n\nThis module provides basic functions for handling mime-types. It can\nhandle matching mime-types against a list of media-ranges. See section\n5.3.2 of the HTTP 1.1 Semantics and Content specification [RFC 7231] for\na complete explanation: https://tools.ietf.org/html/rfc7231#section-5.3.2\n\nInstallation\n------------\n\nUse **pip**:\n\n.. code-block:: sh\n\n    $ pip install python-mimeparse\n\nIt supports Python 3.8+ and PyPy.\n\nFunctions\n---------\n\n**parse_mime_type()**\n\nParses a mime-type into its component parts.\n\n**parse_media_range()**\n\nMedia-ranges are mime-types with wild-cards and a \"q\" quality parameter.\n\n**quality()**\n\nDetermines the quality (\"q\") of a mime-type when compared against a list of\nmedia-ranges.\n\n**quality_parsed()**\n\nJust like ``quality()`` except the second parameter must be pre-parsed.\n\n**best_match()**\n\nChoose the mime-type with the highest quality (\"q\") from a list of candidates.\n\nTesting\n-------\n\nRun the tests by typing: ``python mimeparse_test.py``.\n\nTo make sure that the package works in all the supported environments, you can\nrun **tox** tests:\n\n.. code-block:: sh\n\n    $ pip install tox\n    $ tox\n\nThe format of the JSON test data file is as follows: A top-level JSON object\nwhich has a key for each of the functions to be tested. The value corresponding\nto that key is a list of tests. Each test contains: the argument or arguments\nto the function being tested, the expected results and an optional description.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A module provides basic functions for parsing mime-type names and matching them against a list of media-ranges.",
    "version": "2.0.0",
    "project_urls": {
        "Chat": "https://gitter.im/falconry/user",
        "Funding": "https://opencollective.com/falcon",
        "Homepage": "https://github.com/falconry/python-mimeparse",
        "Issue Tracker": "https://github.com/falconry/python-mimeparse/issues"
    },
    "split_keywords": [
        "mime-type",
        " media-type"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "65d91093a9d6d22d04d433003c96b9b1d46741b43fee5b11ece5098297737fce",
                "md5": "050e64fa810eae5073b5936775044bed",
                "sha256": "574062a06f2e1d416535c8d3b83ccc6ebe95941e74e2c5939fc010a12e37cc09"
            },
            "downloads": -1,
            "filename": "python_mimeparse-2.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "050e64fa810eae5073b5936775044bed",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 5576,
            "upload_time": "2024-08-25T13:38:13",
            "upload_time_iso_8601": "2024-08-25T13:38:13.372279Z",
            "url": "https://files.pythonhosted.org/packages/65/d9/1093a9d6d22d04d433003c96b9b1d46741b43fee5b11ece5098297737fce/python_mimeparse-2.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cd85c40f2e0b2128905f6c34894be01803c114f2b2efab0e8b4c3dca5e56b999",
                "md5": "e3d6505e9af0629a15b4d56d7f34b2ef",
                "sha256": "5b9a9dcf7aa82465e31bd667f5cb7000604811dce83554f1c8a43693a32cb303"
            },
            "downloads": -1,
            "filename": "python_mimeparse-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e3d6505e9af0629a15b4d56d7f34b2ef",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 7162,
            "upload_time": "2024-08-25T13:38:14",
            "upload_time_iso_8601": "2024-08-25T13:38:14.966537Z",
            "url": "https://files.pythonhosted.org/packages/cd/85/c40f2e0b2128905f6c34894be01803c114f2b2efab0e8b4c3dca5e56b999/python_mimeparse-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-25 13:38:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "falconry",
    "github_project": "python-mimeparse",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "python-mimeparse"
}
        
Elapsed time: 0.34496s