Skip to main content

Protocol model

Project description

Protocolmodel

Protocol model for easy use

from protocolmodel.http import HTTPRequest,HttpUrl

http_raw = """GET /Less-1/?id=xxx* HTTP/1.1
Host: 127.0.0.1:8088
Accept-Encoding: gzip, deflate, br
Accept*: */*
X-Forwarded-For: 127.0.0.1*
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/123.0.6312.122 Safari/537.36
Connection: close
Cache-Control: max-age=0

xxxxxx"""

http_reqeust = HTTPRequest.parse_from(http_raw, url="https://127.0.0.1:8088/Less-1/?id=xxx*")

result

http_reqeust.model_dump_json(indent=4))
{
    "http_version": "HTTP/1.1",
    "scheme": "https",
    "method": "GET",
    "host": "127.0.0.1",
    "url": "https://127.0.0.1:8088/Less-1/?id=xxx*",
    "port": 8088,
    "path": "/Less-1/?id=xxx*",
    "headers": {
        "Host": "127.0.0.1:8088",
        "Accept-Encoding": "gzip, deflate, br",
        "Accept*": "*/*",
        "X-Forwarded-For": "127.0.0.1*",
        "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/123.0.6312.122 Safari/537.36",
        "Connection": "close",
        "Cache-Control": "max-age=0"
    },
    "content": "eHh4eHh4"
}

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

protocolmodel-0.0.1b2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file protocolmodel-0.0.1b2-py3-none-any.whl.

File metadata

File hashes

Hashes for protocolmodel-0.0.1b2-py3-none-any.whl
Algorithm Hash digest
SHA256 de8dce100dbab7d75fde5a35e87a563e220185ac318eff18ff84eb6401443b29
MD5 5d365594025f1f6ede71d5b893f99d7a
BLAKE2b-256 74619a01d0ebd893e9361fffe6415542bd8dc16dcdf4b5aff4e128e7ca1e443d

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