TP-HTTP-Request-Response-Parser


NameTP-HTTP-Request-Response-Parser JSON
Version 2025.8.19 PyPI version JSON
download
home_pageNone
SummaryParse/ Unparse the HTTP Request/ Response
upload_time2025-08-19 15:31:24
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseMIT
keywords tpcybersec http request parser http response parser
VCS
bugtrack_url
requirements json-duplicate-keys
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
	<h1>TP-HTTP-Request-Response-Parser - PyPI</h1>
	<i>Parse/ Unparse the HTTP Request/ Response</i>
	<br><br>
	<a href="https://github.com/TPCyberSec/TP-HTTP-Request-Response-Parser/releases/"><img src="https://img.shields.io/github/release/TPCyberSec/TP-HTTP-Request-Response-Parser" height=30></a>
	<a href="#"><img src="https://img.shields.io/github/downloads/TPCyberSec/TP-HTTP-Request-Response-Parser/total" height=30></a>
	<a href="#"><img src="https://img.shields.io/github/stars/TPCyberSec/TP-HTTP-Request-Response-Parser" height=30></a>
	<a href="#"><img src="https://img.shields.io/github/forks/TPCyberSec/TP-HTTP-Request-Response-Parser" height=30></a>
	<a href="https://github.com/TPCyberSec/TP-HTTP-Request-Response-Parser/issues?q=is%3Aopen+is%3Aissue"><img src="https://img.shields.io/github/issues/TPCyberSec/TP-HTTP-Request-Response-Parser" height=30></a>
	<a href="https://github.com/TPCyberSec/TP-HTTP-Request-Response-Parser/issues?q=is%3Aissue+is%3Aclosed"><img src="https://img.shields.io/github/issues-closed/TPCyberSec/TP-HTTP-Request-Response-Parser" height=30></a>
	<br>
	<a href="#"><img src="https://img.shields.io/pypi/v/TP-HTTP-Request-Response-Parser" height=30></a>
	<a href="#"><img src="https://img.shields.io/pypi/pyversions/TP-HTTP-Request-Response-Parser" height=30></a>
	<a href="#"><img src="https://img.shields.io/pypi/dm/TP-HTTP-Request-Response-Parser" height=30></a>
</div>

## Installation
#### From PyPI:
```console
pip install TP-HTTP-Request-Response-Parser
```
#### From Source:
```console
git clone https://github.com/TPCyberSec/TP-HTTP-Request-Response-Parser.git --branch <Branch/Tag>
cd TP-HTTP-Request-Response-Parser
python -m build
python -m pip install dist/TP_HTTP_Request_Response_Parser-<version>-py3-none-any.whl
```

## Basic Usage
```
from tp_http_request_response_parser import TP_HTTP_REQUEST_PARSER, TP_HTTP_RESPONSE_PARSER

# Parsing HTTP Request
rawRequest = """GET /v1/promo/extension HTTP/2
Host: d2y7f743exec8w.cloudfront.net
Accept-Encoding: gzip, deflate
Accept: */*
Accept-Language: en-US;q=0.9,en;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.5845.97 Safari/537.36
Connection: close
Cache-Control: max-age=0

"""

# RequestParser = TP_HTTP_REQUEST_PARSER(open("rawRequest.req").read())
RequestParser = TP_HTTP_REQUEST_PARSER(rawRequest, ordered_dict=True)

print("- request_method: {}".format(RequestParser.request_method))
print("- request_path: {}".format(RequestParser.request_path))
print("- request_pathParams: {}".format(RequestParser.request_pathParams.dumps(indent=4)))
print("- request_queryParams: {}".format(RequestParser.request_queryParams.dumps(indent=4)))
print("- request_fragment: {}".format(RequestParser.request_fragment))
print("- request_httpVersion: {}".format(RequestParser.request_httpVersion))
print("- request_headers: {}".format(RequestParser.request_headers.dumps(indent=4)))
print("- request_cookies: {}".format(RequestParser.request_cookies.dumps(indent=4)))
print("- request_body: {}".format(RequestParser.request_body.dumps(indent=4)))
print(RequestParser.unparse(update_content_length=True))



# Parsing HTTP Response
rawResponse = """HTTP/2 200 OK
Content-Type: application/json; charset=utf-8
Server: nginx
Date: Mon, 21 Aug 2023 03:55:08 GMT
Etag: W/"846e0a9b390c273d2d7a6843085411d1"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 06024e22-f233-4517-b0f6-f444c8464e7b
Strict-Transport-Security: max-age=63072000; includeSubDomains
Strict-Transport-Security: max-age=63072000; preload
Vary: Accept-Encoding,Accept
X-Cache: Miss from cloudfront
Via: 1.1 19175f36fb9c16ba394561bae28598da.cloudfront.net (CloudFront)
X-Amz-Cf-Pop: SGN50-P2
X-Amz-Cf-Id: eKssgTNGDCswPiQtSYFD1MRNBJCTHEbnQp4MQjtQx2B4eM7oqXYIHg==

{"ok":true,"promo":[]}"""

# ResponseParser = TP_HTTP_RESPONSE_PARSER(open("rawResponse.res").read())
ResponseParser = TP_HTTP_RESPONSE_PARSER(rawResponse, ordered_dict=True)

print("- response_httpVersion: {}".format(ResponseParser.response_httpVersion))
print("- response_statusCode: {}".format(ResponseParser.response_statusCode))
print("- response_statusText: {}".format(ResponseParser.response_statusText))
print("- response_headers: {}".format(ResponseParser.response_headers.dumps(indent=4)))
print("- response_cookies: {}".format(ResponseParser.response_cookies.dumps(indent=4)))
print("- response_body: {}".format(ResponseParser.response_body.dumps(indent=4)))
print(ResponseParser.unparse(update_content_length=True))
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "TP-HTTP-Request-Response-Parser",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "TPCyberSec, HTTP Request Parser, HTTP Response Parser",
    "author": null,
    "author_email": "TP Cyber Security <tpcybersec2023@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/b8/d3/3a815e9f39d78b70b1d23292a8a0a71d2fc0eccf4233cce68d4e0ff50ef3/tp_http_request_response_parser-2025.8.19.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\r\n\t<h1>TP-HTTP-Request-Response-Parser - PyPI</h1>\r\n\t<i>Parse/ Unparse the HTTP Request/ Response</i>\r\n\t<br><br>\r\n\t<a href=\"https://github.com/TPCyberSec/TP-HTTP-Request-Response-Parser/releases/\"><img src=\"https://img.shields.io/github/release/TPCyberSec/TP-HTTP-Request-Response-Parser\" height=30></a>\r\n\t<a href=\"#\"><img src=\"https://img.shields.io/github/downloads/TPCyberSec/TP-HTTP-Request-Response-Parser/total\" height=30></a>\r\n\t<a href=\"#\"><img src=\"https://img.shields.io/github/stars/TPCyberSec/TP-HTTP-Request-Response-Parser\" height=30></a>\r\n\t<a href=\"#\"><img src=\"https://img.shields.io/github/forks/TPCyberSec/TP-HTTP-Request-Response-Parser\" height=30></a>\r\n\t<a href=\"https://github.com/TPCyberSec/TP-HTTP-Request-Response-Parser/issues?q=is%3Aopen+is%3Aissue\"><img src=\"https://img.shields.io/github/issues/TPCyberSec/TP-HTTP-Request-Response-Parser\" height=30></a>\r\n\t<a href=\"https://github.com/TPCyberSec/TP-HTTP-Request-Response-Parser/issues?q=is%3Aissue+is%3Aclosed\"><img src=\"https://img.shields.io/github/issues-closed/TPCyberSec/TP-HTTP-Request-Response-Parser\" height=30></a>\r\n\t<br>\r\n\t<a href=\"#\"><img src=\"https://img.shields.io/pypi/v/TP-HTTP-Request-Response-Parser\" height=30></a>\r\n\t<a href=\"#\"><img src=\"https://img.shields.io/pypi/pyversions/TP-HTTP-Request-Response-Parser\" height=30></a>\r\n\t<a href=\"#\"><img src=\"https://img.shields.io/pypi/dm/TP-HTTP-Request-Response-Parser\" height=30></a>\r\n</div>\r\n\r\n## Installation\r\n#### From PyPI:\r\n```console\r\npip install TP-HTTP-Request-Response-Parser\r\n```\r\n#### From Source:\r\n```console\r\ngit clone https://github.com/TPCyberSec/TP-HTTP-Request-Response-Parser.git --branch <Branch/Tag>\r\ncd TP-HTTP-Request-Response-Parser\r\npython -m build\r\npython -m pip install dist/TP_HTTP_Request_Response_Parser-<version>-py3-none-any.whl\r\n```\r\n\r\n## Basic Usage\r\n```\r\nfrom tp_http_request_response_parser import TP_HTTP_REQUEST_PARSER, TP_HTTP_RESPONSE_PARSER\r\n\r\n# Parsing HTTP Request\r\nrawRequest = \"\"\"GET /v1/promo/extension HTTP/2\r\nHost: d2y7f743exec8w.cloudfront.net\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nAccept-Language: en-US;q=0.9,en;q=0.8\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.5845.97 Safari/537.36\r\nConnection: close\r\nCache-Control: max-age=0\r\n\r\n\"\"\"\r\n\r\n# RequestParser = TP_HTTP_REQUEST_PARSER(open(\"rawRequest.req\").read())\r\nRequestParser = TP_HTTP_REQUEST_PARSER(rawRequest, ordered_dict=True)\r\n\r\nprint(\"- request_method: {}\".format(RequestParser.request_method))\r\nprint(\"- request_path: {}\".format(RequestParser.request_path))\r\nprint(\"- request_pathParams: {}\".format(RequestParser.request_pathParams.dumps(indent=4)))\r\nprint(\"- request_queryParams: {}\".format(RequestParser.request_queryParams.dumps(indent=4)))\r\nprint(\"- request_fragment: {}\".format(RequestParser.request_fragment))\r\nprint(\"- request_httpVersion: {}\".format(RequestParser.request_httpVersion))\r\nprint(\"- request_headers: {}\".format(RequestParser.request_headers.dumps(indent=4)))\r\nprint(\"- request_cookies: {}\".format(RequestParser.request_cookies.dumps(indent=4)))\r\nprint(\"- request_body: {}\".format(RequestParser.request_body.dumps(indent=4)))\r\nprint(RequestParser.unparse(update_content_length=True))\r\n\r\n\r\n\r\n# Parsing HTTP Response\r\nrawResponse = \"\"\"HTTP/2 200 OK\r\nContent-Type: application/json; charset=utf-8\r\nServer: nginx\r\nDate: Mon, 21 Aug 2023 03:55:08 GMT\r\nEtag: W/\"846e0a9b390c273d2d7a6843085411d1\"\r\nCache-Control: max-age=0, private, must-revalidate\r\nX-Request-Id: 06024e22-f233-4517-b0f6-f444c8464e7b\r\nStrict-Transport-Security: max-age=63072000; includeSubDomains\r\nStrict-Transport-Security: max-age=63072000; preload\r\nVary: Accept-Encoding,Accept\r\nX-Cache: Miss from cloudfront\r\nVia: 1.1 19175f36fb9c16ba394561bae28598da.cloudfront.net (CloudFront)\r\nX-Amz-Cf-Pop: SGN50-P2\r\nX-Amz-Cf-Id: eKssgTNGDCswPiQtSYFD1MRNBJCTHEbnQp4MQjtQx2B4eM7oqXYIHg==\r\n\r\n{\"ok\":true,\"promo\":[]}\"\"\"\r\n\r\n# ResponseParser = TP_HTTP_RESPONSE_PARSER(open(\"rawResponse.res\").read())\r\nResponseParser = TP_HTTP_RESPONSE_PARSER(rawResponse, ordered_dict=True)\r\n\r\nprint(\"- response_httpVersion: {}\".format(ResponseParser.response_httpVersion))\r\nprint(\"- response_statusCode: {}\".format(ResponseParser.response_statusCode))\r\nprint(\"- response_statusText: {}\".format(ResponseParser.response_statusText))\r\nprint(\"- response_headers: {}\".format(ResponseParser.response_headers.dumps(indent=4)))\r\nprint(\"- response_cookies: {}\".format(ResponseParser.response_cookies.dumps(indent=4)))\r\nprint(\"- response_body: {}\".format(ResponseParser.response_body.dumps(indent=4)))\r\nprint(ResponseParser.unparse(update_content_length=True))\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Parse/ Unparse the HTTP Request/ Response",
    "version": "2025.8.19",
    "project_urls": {
        "Homepage": "https://github.com/TPCyberSec/TP-HTTP-Request-Response-Parser"
    },
    "split_keywords": [
        "tpcybersec",
        " http request parser",
        " http response parser"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "46e528caf91076763542dd13793be437246b019bf7cdd9034a7e2708bcb5d79b",
                "md5": "60d80093f899ebfa8d17daaa48e4482d",
                "sha256": "12421051c0ed8e46e028ed62b1046302cfa2eea011fe3da53db898d695351b31"
            },
            "downloads": -1,
            "filename": "TP_HTTP_Request_Response_Parser-2025.8.19-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "60d80093f899ebfa8d17daaa48e4482d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 8516,
            "upload_time": "2025-08-19T15:31:23",
            "upload_time_iso_8601": "2025-08-19T15:31:23.218453Z",
            "url": "https://files.pythonhosted.org/packages/46/e5/28caf91076763542dd13793be437246b019bf7cdd9034a7e2708bcb5d79b/TP_HTTP_Request_Response_Parser-2025.8.19-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b8d33a815e9f39d78b70b1d23292a8a0a71d2fc0eccf4233cce68d4e0ff50ef3",
                "md5": "0b7b1dbee7dc4d73049b9b470052564d",
                "sha256": "474a0561ffd753b76ee4f599cf38515333863d60f1f95beb96056b2327bed954"
            },
            "downloads": -1,
            "filename": "tp_http_request_response_parser-2025.8.19.tar.gz",
            "has_sig": false,
            "md5_digest": "0b7b1dbee7dc4d73049b9b470052564d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8165,
            "upload_time": "2025-08-19T15:31:24",
            "upload_time_iso_8601": "2025-08-19T15:31:24.719356Z",
            "url": "https://files.pythonhosted.org/packages/b8/d3/3a815e9f39d78b70b1d23292a8a0a71d2fc0eccf4233cce68d4e0ff50ef3/tp_http_request_response_parser-2025.8.19.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-19 15:31:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "TPCyberSec",
    "github_project": "TP-HTTP-Request-Response-Parser",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "json-duplicate-keys",
            "specs": [
                [
                    ">=",
                    "2025.8.19"
                ]
            ]
        }
    ],
    "lcname": "tp-http-request-response-parser"
}
        
Elapsed time: 0.97197s