parserheader


Nameparserheader JSON
Version 0.34 PyPI version JSON
download
home_pagehttps://github.com/cumulus13/parserheader
SummaryParsing headers from string or dictionary
upload_time2022-09-23 20:49:11
maintainercumulus13 Team
docs_urlNone
authorHadi Cahyadi LD
requires_python>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
licenseBSD
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            parserheader
==================

Parsing headers from string or dictionary


Installing
----------

Install and update using `pip`_:

.. code-block:: bash

    $ pip install parserheader

parserheader supports Python 2 and newer, Python 3 and newer, and PyPy.

.. _pip: https://pip.pypa.io/en/stable/quickstart/


Example
----------------

What does it look like? Here is an example of a simple parserheader program:

.. code-block:: 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:

.. code-block:: 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


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cumulus13/parserheader",
    "name": "parserheader",
    "maintainer": "cumulus13 Team",
    "docs_url": null,
    "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
    "maintainer_email": "cumulus13@gmail.com",
    "keywords": "",
    "author": "Hadi Cahyadi LD",
    "author_email": "cumulus13@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/9c/f5/68cb362ccb8df9efff87198c515cda79f2b627239a4cd5b1315ba448b629/parserheader-0.34.tar.gz",
    "platform": null,
    "description": "parserheader\n==================\n\nParsing headers from string or dictionary\n\n\nInstalling\n----------\n\nInstall and update using `pip`_:\n\n.. code-block:: bash\n\n    $ pip install parserheader\n\nparserheader supports Python 2 and newer, Python 3 and newer, and PyPy.\n\n.. _pip: https://pip.pypa.io/en/stable/quickstart/\n\n\nExample\n----------------\n\nWhat does it look like? Here is an example of a simple parserheader program:\n\n.. code-block:: python\n\n    import parserheader\n\n    ...\n\n    def setHeaders():\n        ph = parserheader.parserheader()\n        header_str = \"\"\"\n            POST /upload/ HTTP/1.1\n            Host: google.com.com\n            Connection: keep-alive\n            Content-Length: 1220\n            Cache-Control: max-age=0\n            Origin: http://www.google.com.com\n            Upgrade-Insecure-Requests: 1\n            Content-Type: application/x-www-form-urlencoded\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\n            Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3\n            Referer: http://www.google.com/\n            Accept-Encoding: gzip, deflate\n            Accept-Language: en-US,en;q=0.9,id;q=0.8\n            Cookie: PHPSESSID=41a0f0ac4545d3f5ba9a4ba415b777e9\n        \"\"\"\n        headers = ph.parserHeader(header_str)\n        print(\"headers =\", headers)\n        return headers\n\n    setHeaders()\n\n\nAnd what it looks like when run:\n\n.. code-block:: bash\n\n    $ python test.py \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'}\n\n\nSupport\n--------\n\n*   Python 2.7 +, Python 3.x\n*   Windows, Linux\n\nLinks\n------\n\n*   License: `MIT <https://github.com/cumulus13/parserheader/src/default/LICENSE.rst>`_\n*   Code: https://github.com/cumulus13/parserheader\n*   Issue tracker: https://github.com/cumulus13/parserheader/issues\n\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Parsing headers from string or dictionary",
    "version": "0.34",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "b0b69a950aab6f04c6474617b8eeabc0",
                "sha256": "2ca71a8a31b392e00a8ad5cc4a75ce6872e73917557034ca35fa60c318f81067"
            },
            "downloads": -1,
            "filename": "parserheader-0.34-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b0b69a950aab6f04c6474617b8eeabc0",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
            "size": 9384,
            "upload_time": "2022-09-23T20:49:09",
            "upload_time_iso_8601": "2022-09-23T20:49:09.800107Z",
            "url": "https://files.pythonhosted.org/packages/e9/15/4319a3df9cc7c159822d6743ea816ebf82887a991e96e540af4e9148136c/parserheader-0.34-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "9f07327c8b711332d91ba1705548d08d",
                "sha256": "8c25af8f6025063f3f096d1ac5681fe6c0f51d60b26169b7d9d04e45b1c8092e"
            },
            "downloads": -1,
            "filename": "parserheader-0.34.tar.gz",
            "has_sig": false,
            "md5_digest": "9f07327c8b711332d91ba1705548d08d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
            "size": 7420,
            "upload_time": "2022-09-23T20:49:11",
            "upload_time_iso_8601": "2022-09-23T20:49:11.851446Z",
            "url": "https://files.pythonhosted.org/packages/9c/f5/68cb362ccb8df9efff87198c515cda79f2b627239a4cd5b1315ba448b629/parserheader-0.34.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-09-23 20:49:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "cumulus13",
    "github_project": "parserheader",
    "lcname": "parserheader"
}
        
Elapsed time: 0.01957s