Skip to main content

No project description provided

Project description

TP_HTTP_Request_Response_Parser

from TP_HTTP_Request_Response_Parser import *

# 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(rawRequest)

print(RequestParser.request_method)
print(RequestParser.request_path)
print(RequestParser.request_query)
print(RequestParser.request_fragment)
print(RequestParser.request_headers.getObject())
print(RequestParser.request_body)



# 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(rawResponse)

print(ResponseParser.status_code)
print(ResponseParser.status_text)
print(ResponseParser.response_headers.getObject())
print(ResponseParser.response_body)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

TP_HTTP_Request_Response_Parser-2023.9.3.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file TP_HTTP_Request_Response_Parser-2023.9.3.tar.gz.

File metadata

File hashes

Hashes for TP_HTTP_Request_Response_Parser-2023.9.3.tar.gz
Algorithm Hash digest
SHA256 4b09f6f74b741ff866ec76fc58853184e9d3bac77f93db00bc62c57c2cbb4d66
MD5 91a4e95332eee62ce26705b4a40c21d2
BLAKE2b-256 202af20269c9f42676f2e5542ac24912832a616b911bd283987e13b0cc19291e

See more details on using hashes here.

File details

Details for the file TP_HTTP_Request_Response_Parser-2023.9.3-py3-none-any.whl.

File metadata

File hashes

Hashes for TP_HTTP_Request_Response_Parser-2023.9.3-py3-none-any.whl
Algorithm Hash digest
SHA256 774c5bf3cea6e57ef1203e7187c9f799c8bbcee89c079a43c8dd6f59ec925d67
MD5 3081d66c47ca095109a8b4f8af3bc0b2
BLAKE2b-256 166c1170d10a0c577b6d28e59c8f77788b69a08b042098693ddef408e4997245

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page