Skip to main content

A simple HTTP request parser.

Project description

HTTP Parse

A lightweight Python library for parsing raw HTTP requests.

Installation

pip install http-parse

Usage

from http_parse import parse

raw_request = """
GET /path HTTP/1.1
Host: example.com
User-Agent: curl/8.5.0

{"data": "example"}
"""

parsed = parse(raw_request)
print(parsed.headers)  # Access headers (dictionary format)
print(parsed.body)     # Access body 
print(parsed.path)      # Access requested path (/foo/bar)

Features

  • Parse HTTP headers into a dictionary
  • Access request body
  • Access and modify headers
  • Extract URL and HTTP method

License

MIT License

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

http_parse-0.1.5.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

http_parse-0.1.5-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file http_parse-0.1.5.tar.gz.

File metadata

  • Download URL: http_parse-0.1.5.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for http_parse-0.1.5.tar.gz
Algorithm Hash digest
SHA256 80011a31eac334439684529d791c42d8f9df71f713ade056e55d4d5df106492a
MD5 b4037b932251c6633b1974e5a1185f84
BLAKE2b-256 6cd11762936084e22fba1ca6407a1554db73a3fff04bcc83acf20b9a540c2c61

See more details on using hashes here.

File details

Details for the file http_parse-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: http_parse-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 2.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for http_parse-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1768980a143a59e7d814d45629a1de707c0652f6e7ac26ae38fa612c938c115f
MD5 8ddfa44ab484947413b3b7b70f33fb23
BLAKE2b-256 6e7bfa0f4a4c02fa0bb9f1e4743a3357bb770e7b1b1f90c28d2428928d84c85a

See more details on using hashes here.

Supported by

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