{ "info": { "author": "Sanket Saurav", "author_email": "sanketsaurav@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "\n# mimelib \ud83d\ude4a\n\n[![Build Status](https://travis-ci.org/sanketsaurav/mimelib.svg?branch=master)](https://travis-ci.org/sanketsaurav/mimelib) [![Coverage Status](https://coveralls.io/repos/github/sanketsaurav/mimelib/badge.svg?branch=master)](https://coveralls.io/github/sanketsaurav/mimelib?branch=master) [![Maintainability](https://api.codeclimate.com/v1/badges/8422f69519a864a93df2/maintainability)](https://codeclimate.com/github/sanketsaurav/mimelib/maintainability)\n\n> A MIME type is a label used to identify a type of data. It is used so software can know how to handle the data.\n> It serves the same purpose on the Internet that file extensions do on Microsoft Windows.\n> — [Quentin](https://stackoverflow.com/a/3828381/1088579)\n\n`mimelib` aims at working with MIME types easier in Python. The standard library comes with the [mimetypes](https://docs.python.org/3/library/mimetypes.html)\nmodule. This library builds on top of it and adds more niceties to it, so you're generally happier when working with MIME types today.\n\n\n```python\n>>> import mimelib\n>>> mimelib.mimetype('application/json').is_text\nTrue\n>>> mimelib.url('https://example.com/avatar.jpg').is_image\nTrue\n>>> mimelib.url('pianoman.mp3').file_type\nmedia\n```\n\n## Installation\n\nTo install mimelib, use pipenv (or pip):\n\n```\n$ pipenv install mimelib\n```\n\n## Usage\n\n`mimelib` is intended to be used alongside the `mimetypes` standard library\nmodule, and builds on top of it under the hood. So, if you are adding additional\nMIME types to be recognized, `mimelib` will work just as fine.\n\n### Initialization\nEither a valid MIME type string, or a URL or path can be used to work with `mimelib`.\n\n```python\n>>> m1 = mimelib.mimetype(\"application/json\") # pass a valid MIME type\n>>> m2 = mimelib.url(\"foo/bar/dataset.csv\") # or pass a path / url\n```\n\nBoth these methods return a `MIME` object, the various useful properties of which\nare listed below.\n\n### Getting the file type\n\nThe following file types are reported: `text`, `image`, `media` and `binary`.\n\n```python\n>>> mimelib.mimetype(\"application/ecmascript\").file_type\ntext\n>>> mimelib.mimetype(\"video/mpeg\").file_type\nmedia\n>>> mimelib.url(\"archive.rar\").file_type\nbinary\n```\n\nThe `Mime` object also has the following properties for conveniently checking\nspecific file types:\n\n - `is_text`\n - `is_image`\n - `is_media`\n - `is_binary`\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sanketsaurav/mimelib", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "mimelib", "package_url": "https://pypi.org/project/mimelib/", "platform": "", "project_url": "https://pypi.org/project/mimelib/", "project_urls": { "Homepage": "https://github.com/sanketsaurav/mimelib" }, "release_url": "https://pypi.org/project/mimelib/0.1.1/", "requires_dist": [ "future", "six" ], "requires_python": ">=2.7.0", "summary": "Better MIME types in Python.", "version": "0.1.1" }, "last_serial": 3971131, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "bf3a77c8d80dc4a36cc4e1d3a7a17541", "sha256": "9d8aa46774df9699fa578ea7379067bac65193c932ae9ec9120560ab4343b90f" }, "downloads": -1, "filename": "mimelib-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "bf3a77c8d80dc4a36cc4e1d3a7a17541", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7.0", "size": 4561, "upload_time": "2018-06-16T07:37:52", "url": "https://files.pythonhosted.org/packages/1d/7c/1fbc06be4088987ed3f0de831cd22c34d44966a3d1891bedc02801a6e9e7/mimelib-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6a21ba8457c771cdf76127c4e45cd2a0", "sha256": "aca41bc927c238cdf3727ea09c08c7fcde79600b97e38a58f4306d285ae4a93c" }, "downloads": -1, "filename": "mimelib-0.1.0.tar.gz", "has_sig": false, "md5_digest": "6a21ba8457c771cdf76127c4e45cd2a0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7.0", "size": 5421, "upload_time": "2018-06-16T07:37:53", "url": "https://files.pythonhosted.org/packages/84/dd/2ba2f1e6ff8224ec8091f336ca403c7a91ae36ee47eed7362e1466011d7b/mimelib-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "d31a1205a292962cf10212e9891898e7", "sha256": "70607238b57b1411d5bfc68661885f81ac00127d22bdaf71a1c857005693934b" }, "downloads": -1, "filename": "mimelib-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d31a1205a292962cf10212e9891898e7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7.0", "size": 4573, "upload_time": "2018-06-17T14:12:05", "url": "https://files.pythonhosted.org/packages/b1/a9/6b2ca090da519f1b22831e9f3fa3bb9634c3fdcb304323e01134feddb58a/mimelib-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6f28b0ed459cdc26b7dda9933efc9dec", "sha256": "9b36a5337ff7a8f31e5d5fbb8da17cc1debe299297df002cdfe12f5ae5e0f468" }, "downloads": -1, "filename": "mimelib-0.1.1.tar.gz", "has_sig": false, "md5_digest": "6f28b0ed459cdc26b7dda9933efc9dec", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7.0", "size": 5435, "upload_time": "2018-06-17T14:12:07", "url": "https://files.pythonhosted.org/packages/77/7f/da82188fb6d0e279734ca5185d1b509c166ae8d6f8b825ea325615ca5eb5/mimelib-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d31a1205a292962cf10212e9891898e7", "sha256": "70607238b57b1411d5bfc68661885f81ac00127d22bdaf71a1c857005693934b" }, "downloads": -1, "filename": "mimelib-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d31a1205a292962cf10212e9891898e7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7.0", "size": 4573, "upload_time": "2018-06-17T14:12:05", "url": "https://files.pythonhosted.org/packages/b1/a9/6b2ca090da519f1b22831e9f3fa3bb9634c3fdcb304323e01134feddb58a/mimelib-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6f28b0ed459cdc26b7dda9933efc9dec", "sha256": "9b36a5337ff7a8f31e5d5fbb8da17cc1debe299297df002cdfe12f5ae5e0f468" }, "downloads": -1, "filename": "mimelib-0.1.1.tar.gz", "has_sig": false, "md5_digest": "6f28b0ed459cdc26b7dda9933efc9dec", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7.0", "size": 5435, "upload_time": "2018-06-17T14:12:07", "url": "https://files.pythonhosted.org/packages/77/7f/da82188fb6d0e279734ca5185d1b509c166ae8d6f8b825ea325615ca5eb5/mimelib-0.1.1.tar.gz" } ] }