pycontent-type


Namepycontent-type JSON
Version 1.1.0 PyPI version JSON
download
home_page
SummaryPython library to access all Supported Content-Types/Media-Types
upload_time2023-05-26 09:20:50
maintainer
docs_urlNone
author
requires_python>=3.7
license
keywords content-type mime mime-type media-type
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pycontent-type

<p align="center">
    <em>A Python library to access all Supported Content-Types/Media-Types ⚡</em>
</p>

<p align="center">
<a href="https://github.com/yezz123/pycontent-type/actions/workflows/ci.yml" target="_blank">
    <img src="https://github.com/yezz123/pycontent-type/actions/workflows/ci.yml/badge.svg" alt="lint">
</a>
<a href="https://pypi.org/project/pycontent-type" target="_blank">
    <img src="https://img.shields.io/pypi/v/pycontent-type?color=%2334D058&label=pypi%20package" alt="Package version">
</a>
<a href="https://codecov.io/gh/yezz123/pycontent-type">
    <img src="https://codecov.io/gh/yezz123/pycontent-type/branch/main/graph/badge.svg"/>
</a>
</p>

## Installation

You can add pycontent-type in a few easy steps. First of all, install the dependency:

```shell
$ pip install pycontent-type

---> 100%

Successfully installed pycontent-type
```

## Usage

We have a simple API to access all the supported content-types:

As known the categories of content-types are:

- `application`
- `audio`
- `font`
- `image`
- `message`
- `model`
- `multipart`
- `text`
- `video`

### Get Content-Type by extension

```python
# Get content-type for application
import pycontent_type

len(pycontent_type.application)

>>> 1551

# Get content-type for specific extension using Name
pycontent_type.application.get(Name='json')

>>> application(Name='json', Template='application/json')

# Get content-type for specific extension using Template
pycontent_type.application.get(Template='application/xml')

>>> application(Name='xml', Template='application/xml')
```

The same applies for all the categories, we have 2 ways to get the content-type:

- Using `Name` attribute
- Using `Template` attribute

## Development 🚧

### Setup environment 📦

You should create a virtual environment and activate it:

```bash
python -m venv venv/
```

```bash
source venv/bin/activate
```

And then install the development dependencies:

```bash
# Install dependencies
pip install -e .[test,lint]
```

### Run tests 🌝

You can run all the tests with:

```bash
bash scripts/test.sh
```

### Format the code 🍂

Execute the following command to apply `pre-commit` formatting:

```bash
bash scripts/format.sh
```

## License

This project is licensed under the terms of the MIT license.
            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pycontent-type",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "Content-Type,MIME,MIME-Type,Media-Type",
    "author": "",
    "author_email": "Yasser Tahiri <hello@yezz.me>",
    "download_url": "https://files.pythonhosted.org/packages/d1/89/d3857db81a2177564f6817182ce8fd1231b407b9b9511547251073ef941b/pycontent_type-1.1.0.tar.gz",
    "platform": null,
    "description": "# pycontent-type\n\n<p align=\"center\">\n    <em>A Python library to access all Supported Content-Types/Media-Types \u26a1</em>\n</p>\n\n<p align=\"center\">\n<a href=\"https://github.com/yezz123/pycontent-type/actions/workflows/ci.yml\" target=\"_blank\">\n    <img src=\"https://github.com/yezz123/pycontent-type/actions/workflows/ci.yml/badge.svg\" alt=\"lint\">\n</a>\n<a href=\"https://pypi.org/project/pycontent-type\" target=\"_blank\">\n    <img src=\"https://img.shields.io/pypi/v/pycontent-type?color=%2334D058&label=pypi%20package\" alt=\"Package version\">\n</a>\n<a href=\"https://codecov.io/gh/yezz123/pycontent-type\">\n    <img src=\"https://codecov.io/gh/yezz123/pycontent-type/branch/main/graph/badge.svg\"/>\n</a>\n</p>\n\n## Installation\n\nYou can add pycontent-type in a few easy steps. First of all, install the dependency:\n\n```shell\n$ pip install pycontent-type\n\n---> 100%\n\nSuccessfully installed pycontent-type\n```\n\n## Usage\n\nWe have a simple API to access all the supported content-types:\n\nAs known the categories of content-types are:\n\n- `application`\n- `audio`\n- `font`\n- `image`\n- `message`\n- `model`\n- `multipart`\n- `text`\n- `video`\n\n### Get Content-Type by extension\n\n```python\n# Get content-type for application\nimport pycontent_type\n\nlen(pycontent_type.application)\n\n>>> 1551\n\n# Get content-type for specific extension using Name\npycontent_type.application.get(Name='json')\n\n>>> application(Name='json', Template='application/json')\n\n# Get content-type for specific extension using Template\npycontent_type.application.get(Template='application/xml')\n\n>>> application(Name='xml', Template='application/xml')\n```\n\nThe same applies for all the categories, we have 2 ways to get the content-type:\n\n- Using `Name` attribute\n- Using `Template` attribute\n\n## Development \ud83d\udea7\n\n### Setup environment \ud83d\udce6\n\nYou should create a virtual environment and activate it:\n\n```bash\npython -m venv venv/\n```\n\n```bash\nsource venv/bin/activate\n```\n\nAnd then install the development dependencies:\n\n```bash\n# Install dependencies\npip install -e .[test,lint]\n```\n\n### Run tests \ud83c\udf1d\n\nYou can run all the tests with:\n\n```bash\nbash scripts/test.sh\n```\n\n### Format the code \ud83c\udf42\n\nExecute the following command to apply `pre-commit` formatting:\n\n```bash\nbash scripts/format.sh\n```\n\n## License\n\nThis project is licensed under the terms of the MIT license.",
    "bugtrack_url": null,
    "license": "",
    "summary": "Python library to access all Supported Content-Types/Media-Types",
    "version": "1.1.0",
    "project_urls": {
        "Funding": "https://github.com/sponsors/yezz123",
        "Homepage": "https://github.com/yezz123/pycontent_type"
    },
    "split_keywords": [
        "content-type",
        "mime",
        "mime-type",
        "media-type"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "777614befff13d906c3390b86385a67e2a793b458d1fc24093af5981ada24539",
                "md5": "2cf2739f961b09490094185a8b5299ff",
                "sha256": "4e519884ce9f949b00a0e75bb7df76533814e4bf80d8b323df35612767f17017"
            },
            "downloads": -1,
            "filename": "pycontent_type-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2cf2739f961b09490094185a8b5299ff",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 29382,
            "upload_time": "2023-05-26T09:20:49",
            "upload_time_iso_8601": "2023-05-26T09:20:49.766563Z",
            "url": "https://files.pythonhosted.org/packages/77/76/14befff13d906c3390b86385a67e2a793b458d1fc24093af5981ada24539/pycontent_type-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d189d3857db81a2177564f6817182ce8fd1231b407b9b9511547251073ef941b",
                "md5": "d2ed02aa1bb321d3b32643b11d2008ab",
                "sha256": "978c6315daa40de51f3789465772469dc2c1a5937383f57156b6ff48350e67f5"
            },
            "downloads": -1,
            "filename": "pycontent_type-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d2ed02aa1bb321d3b32643b11d2008ab",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 30791,
            "upload_time": "2023-05-26T09:20:50",
            "upload_time_iso_8601": "2023-05-26T09:20:50.981473Z",
            "url": "https://files.pythonhosted.org/packages/d1/89/d3857db81a2177564f6817182ce8fd1231b407b9b9511547251073ef941b/pycontent_type-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-26 09:20:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sponsors",
    "github_project": "yezz123",
    "github_not_found": true,
    "lcname": "pycontent-type"
}
        
Elapsed time: 0.07564s