parserheader
==================
Parsing headers from string or dictionary
Installing
----------
Install and update using `pip`:
```bash:
$ pip install parserheader
```
parserheader supports Python 2 and newer, Python 3 and newer, and PyPy.
Example
----------------
What does it look like? Here is an example of a simple parserheader program:
```python:
import parserheader
...
def setHeaders():
ph = parserheader.parserheader()
header_str = """
POST /upload/ HTTP/1.1
Host: google.com.com
Connection: keep-alive
Content-Length: 1220
Cache-Control: max-age=0
Origin: http://www.google.com.com
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Referer: http://www.google.com/
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9,id;q=0.8
Cookie: PHPSESSID=41a0f0ac4545d3f5ba9a4ba415b777e9
"""
headers = ph.parserHeader(header_str)
print("headers =", headers)
return headers
setHeaders()
```
And what it looks like when run:
```bash:
$ python test.py
headers = {'Origin': 'http://www.google.com', 'Content-Length': '1220', 'Accept-Language': 'en-US,en;q=0.9,id;q=0.8', 'Accept-Encoding': 'gzip, deflate', 'Connection': 'keep-alive', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36', 'Host': 'google.com', 'Referer': 'http://www.google.com/', 'Cache-Control': 'max-age=0', 'Cookie': 'PHPSESSID=41a0f0ac4545d3f5ba9a4ba415b777e9', 'Upgrade-Insecure-Requests': '1', 'Content-Type': 'application/x-www-form-urlencoded'}
```
Support
--------
* Python 2.7 +, Python 3.x
* Windows, Linux
Links
------
* License: `MIT <https://github.com/cumulus13/parserheader/src/default/LICENSE.rst>`_
* Code: https://github.com/cumulus13/parserheader
* Issue tracker: https://github.com/cumulus13/parserheader/issues
Author
----------
[Hadi Cahyadi](mailto:cumulus13@gmail.com)
[![Buy Me a Coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/cumulus13)
[![Donate via Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/cumulus13)
[Support me on Patreon](https://www.patreon.com/cumulus13)
Raw data
{
"_id": null,
"home_page": "https://github.com/cumulus13/parserheader",
"name": "parserheader",
"maintainer": "cumulus13 Team",
"docs_url": null,
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7",
"maintainer_email": "cumulus13@gmail.com",
"keywords": null,
"author": "Hadi Cahyadi LD",
"author_email": "cumulus13@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c0/03/f0b5fd44df00372bab453fcc509c1e55a01fab3c592f221ad93589d232d1/parserheader-0.37.tar.gz",
"platform": null,
"description": "\r\nparserheader\r\n==================\r\n\r\nParsing headers from string or dictionary\r\n\r\n\r\nInstalling\r\n----------\r\n\r\nInstall and update using `pip`:\r\n\r\n```bash:\r\n\r\n $ pip install parserheader\r\n```\r\nparserheader supports Python 2 and newer, Python 3 and newer, and PyPy.\r\n\r\nExample\r\n----------------\r\n\r\nWhat does it look like? Here is an example of a simple parserheader program:\r\n\r\n```python:\r\n\r\n import parserheader\r\n \r\n ...\r\n\r\n def setHeaders():\r\n ph = parserheader.parserheader()\r\n header_str = \"\"\"\r\n POST /upload/ HTTP/1.1\r\n Host: google.com.com\r\n Connection: keep-alive\r\n Content-Length: 1220\r\n Cache-Control: max-age=0\r\n Origin: http://www.google.com.com\r\n Upgrade-Insecure-Requests: 1\r\n Content-Type: application/x-www-form-urlencoded\r\n User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36\r\n Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3\r\n Referer: http://www.google.com/\r\n Accept-Encoding: gzip, deflate\r\n Accept-Language: en-US,en;q=0.9,id;q=0.8\r\n Cookie: PHPSESSID=41a0f0ac4545d3f5ba9a4ba415b777e9\r\n \"\"\"\r\n headers = ph.parserHeader(header_str)\r\n print(\"headers =\", headers)\r\n return headers\r\n\r\n setHeaders()\r\n\r\n```\r\nAnd what it looks like when run:\r\n\r\n```bash:\r\n\r\n $ python test.py \r\n headers = {'Origin': 'http://www.google.com', 'Content-Length': '1220', 'Accept-Language': 'en-US,en;q=0.9,id;q=0.8', 'Accept-Encoding': 'gzip, deflate', 'Connection': 'keep-alive', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36', 'Host': 'google.com', 'Referer': 'http://www.google.com/', 'Cache-Control': 'max-age=0', 'Cookie': 'PHPSESSID=41a0f0ac4545d3f5ba9a4ba415b777e9', 'Upgrade-Insecure-Requests': '1', 'Content-Type': 'application/x-www-form-urlencoded'}\r\n```\r\n\r\nSupport\r\n--------\r\n\r\n* Python 2.7 +, Python 3.x\r\n* Windows, Linux\r\n\r\nLinks\r\n------\r\n\r\n* License: `MIT <https://github.com/cumulus13/parserheader/src/default/LICENSE.rst>`_\r\n* Code: https://github.com/cumulus13/parserheader\r\n* Issue tracker: https://github.com/cumulus13/parserheader/issues\r\n\r\nAuthor\r\n----------\r\n\r\n[Hadi Cahyadi](mailto:cumulus13@gmail.com)\r\n\r\n[![Buy Me a Coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/cumulus13)\r\n\r\n[![Donate via Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/cumulus13)\r\n [Support me on Patreon](https://www.patreon.com/cumulus13)\r\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "Parsing headers from string or dictionary",
"version": "0.37",
"project_urls": {
"Code": "https://github.com/cumulus13/parserheader",
"Documentation": "https://github.com/cumulus13/parserheader",
"Homepage": "https://github.com/cumulus13/parserheader"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "956d33e251c3a0c69d3cb84dbca338aafe1d7ccdcb65fdac1f28e49dce7bd6be",
"md5": "0522e8f78ecce7ed058083e7e9d60b55",
"sha256": "8acbdc85795b27471f215690abb2ce23535a3256f9ac0ec2d213b5b1bb6c32d6"
},
"downloads": -1,
"filename": "parserheader-0.37-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "0522e8f78ecce7ed058083e7e9d60b55",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7",
"size": 9982,
"upload_time": "2024-10-23T15:08:41",
"upload_time_iso_8601": "2024-10-23T15:08:41.838443Z",
"url": "https://files.pythonhosted.org/packages/95/6d/33e251c3a0c69d3cb84dbca338aafe1d7ccdcb65fdac1f28e49dce7bd6be/parserheader-0.37-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c003f0b5fd44df00372bab453fcc509c1e55a01fab3c592f221ad93589d232d1",
"md5": "d12df2c0dc0d692e4676e70c9cfcfb72",
"sha256": "799d6081c97a2c6dd25641c140f0282054ad5cb92f6fe5eaf78ce6532c9f7727"
},
"downloads": -1,
"filename": "parserheader-0.37.tar.gz",
"has_sig": false,
"md5_digest": "d12df2c0dc0d692e4676e70c9cfcfb72",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7",
"size": 7422,
"upload_time": "2024-10-23T15:08:43",
"upload_time_iso_8601": "2024-10-23T15:08:43.573496Z",
"url": "https://files.pythonhosted.org/packages/c0/03/f0b5fd44df00372bab453fcc509c1e55a01fab3c592f221ad93589d232d1/parserheader-0.37.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-23 15:08:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cumulus13",
"github_project": "parserheader",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "parserheader"
}