You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.4KB

  1. Metadata-Version: 2.0
  2. Name: python-mimeparse
  3. Version: 1.6.0
  4. Summary: A module provides basic functions for parsing mime-type names and matching them against a list of media-ranges.
  5. Home-page: https://github.com/dbtsai/python-mimeparse
  6. Author: DB Tsai
  7. Author-email: dbtsai@dbtsai.com
  8. License: UNKNOWN
  9. Download-URL: https://github.com/dbtsai/python-mimeparse/tarball/1.6.0
  10. Keywords: mime-type
  11. Platform: UNKNOWN
  12. Classifier: Programming Language :: Python
  13. Classifier: Programming Language :: Python :: 3
  14. Classifier: License :: OSI Approved :: MIT License
  15. Classifier: Operating System :: OS Independent
  16. Classifier: Development Status :: 5 - Production/Stable
  17. Classifier: Intended Audience :: Developers
  18. Classifier: Topic :: Internet :: WWW/HTTP
  19. Classifier: Topic :: Software Development :: Libraries :: Python Modules
  20. Python-MimeParse
  21. ================
  22. .. image:: https://travis-ci.org/dbtsai/python-mimeparse.svg?branch=master
  23. :target: https://travis-ci.org/dbtsai/python-mimeparse
  24. This module provides basic functions for handling mime-types. It can
  25. handle matching mime-types against a list of media-ranges. See section
  26. 5.3.2 of the HTTP 1.1 Semantics and Content specification [RFC 7231] for
  27. a complete explanation: https://tools.ietf.org/html/rfc7231#section-5.3.2
  28. Installation
  29. ------------
  30. Use **pip**:
  31. .. code-block:: sh
  32. $ pip install python-mimeparse
  33. It supports Python 2.7 - 3.5 and PyPy.
  34. Functions
  35. ---------
  36. **parse_mime_type()**
  37. Parses a mime-type into its component parts.
  38. **parse_media_range()**
  39. Media-ranges are mime-types with wild-cards and a "q" quality parameter.
  40. **quality()**
  41. Determines the quality ("q") of a mime-type when compared against a list of
  42. media-ranges.
  43. **quality_parsed()**
  44. Just like ``quality()`` except the second parameter must be pre-parsed.
  45. **best_match()**
  46. Choose the mime-type with the highest quality ("q") from a list of candidates.
  47. Testing
  48. -------
  49. Run the tests by typing: ``python mimeparse_test.py``. The tests require Python 2.6.
  50. To make sure that the package works in all the supported environments, you can
  51. run **tox** tests:
  52. .. code-block:: sh
  53. $ pip install tox
  54. $ tox
  55. The format of the JSON test data file is as follows: A top-level JSON object
  56. which has a key for each of the functions to be tested. The value corresponding
  57. to that key is a list of tests. Each test contains: the argument or arguments
  58. to the function being tested, the expected results and an optional description.