pyrfc6266


Namepyrfc6266 JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://github.com/JohnDoee/pyrfc6266
SummaryRFC6266 implementation in Python
upload_time2022-04-29 14:53:23
maintainer
docs_urlNone
authorAnders Jensen
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements pyparsing
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyrfc6266

![Tests](https://github.com/JohnDoee/pyrfc6266/actions/workflows/main.yml/badge.svg?branch=master)

A python implementation of RFC 6266 meant to replace https://github.com/g2p/rfc6266 and its forks as they rely on LEPL.

This implementation relies on pyparsing which seems to continue to get updates.

## Installation

```
pip install pyrfc6266
```

## Usage

Parse a content-disposition header into its components:

```python
>>> import pyrfc6266
>>> pyrfc6266.parse('attachment; filename="foo.html"')
('attachment', [ContentDisposition(name='filename', value='foo.html')])
```

Parse a header into a useful filename:

```python
>>> import pyrfc6266
>>> pyrfc6266.parse_filename('attachment; filename="foo.html"')
'foo.html'
```

Turn a requests response into a filename:

```python
>>> import requests
>>> import pyrfc6266
>>> response = requests.get('http://httpbin.org/response-headers?Content-Disposition=attachment;%20filename%3d%22foo.html%22')
>>> pyrfc6266.requests_response_to_filename(response)
'foo.html'
```

## License

MIT


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/JohnDoee/pyrfc6266",
    "name": "pyrfc6266",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Anders Jensen",
    "author_email": "andersandjensen@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/74/ef/693fe33d34317facaf26a5716f965dac492d0f47e56e90bf310d7d4e74df/pyrfc6266-1.0.2.tar.gz",
    "platform": null,
    "description": "# pyrfc6266\n\n![Tests](https://github.com/JohnDoee/pyrfc6266/actions/workflows/main.yml/badge.svg?branch=master)\n\nA python implementation of RFC 6266 meant to replace https://github.com/g2p/rfc6266 and its forks as they rely on LEPL.\n\nThis implementation relies on pyparsing which seems to continue to get updates.\n\n## Installation\n\n```\npip install pyrfc6266\n```\n\n## Usage\n\nParse a content-disposition header into its components:\n\n```python\n>>> import pyrfc6266\n>>> pyrfc6266.parse('attachment; filename=\"foo.html\"')\n('attachment', [ContentDisposition(name='filename', value='foo.html')])\n```\n\nParse a header into a useful filename:\n\n```python\n>>> import pyrfc6266\n>>> pyrfc6266.parse_filename('attachment; filename=\"foo.html\"')\n'foo.html'\n```\n\nTurn a requests response into a filename:\n\n```python\n>>> import requests\n>>> import pyrfc6266\n>>> response = requests.get('http://httpbin.org/response-headers?Content-Disposition=attachment;%20filename%3d%22foo.html%22')\n>>> pyrfc6266.requests_response_to_filename(response)\n'foo.html'\n```\n\n## License\n\nMIT\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "RFC6266 implementation in Python",
    "version": "1.0.2",
    "project_urls": {
        "Homepage": "https://github.com/JohnDoee/pyrfc6266"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "69fcd416c1bfb54f86259f631fd9ff6a9b813f7050129a377d94c43500109479",
                "md5": "a39ed6517b58e039634416aae166a612",
                "sha256": "0532307f319566f337dba97577dfaefe493c3e0c40ab211449ba4566fc2cf73d"
            },
            "downloads": -1,
            "filename": "pyrfc6266-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a39ed6517b58e039634416aae166a612",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4729,
            "upload_time": "2022-04-29T14:53:22",
            "upload_time_iso_8601": "2022-04-29T14:53:22.569843Z",
            "url": "https://files.pythonhosted.org/packages/69/fc/d416c1bfb54f86259f631fd9ff6a9b813f7050129a377d94c43500109479/pyrfc6266-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "74ef693fe33d34317facaf26a5716f965dac492d0f47e56e90bf310d7d4e74df",
                "md5": "5425d70b50a72609bba3f44fd9382b1d",
                "sha256": "3c41616b6a1f2e9a26df7f005fbaa634f960121769ccc4445acfb404e9f8fd4c"
            },
            "downloads": -1,
            "filename": "pyrfc6266-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "5425d70b50a72609bba3f44fd9382b1d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4454,
            "upload_time": "2022-04-29T14:53:23",
            "upload_time_iso_8601": "2022-04-29T14:53:23.805315Z",
            "url": "https://files.pythonhosted.org/packages/74/ef/693fe33d34317facaf26a5716f965dac492d0f47e56e90bf310d7d4e74df/pyrfc6266-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-04-29 14:53:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "JohnDoee",
    "github_project": "pyrfc6266",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "pyparsing",
            "specs": [
                [
                    "~=",
                    "3.0.7"
                ]
            ]
        }
    ],
    "lcname": "pyrfc6266"
}
        
Elapsed time: 0.23234s