Skip to content

ritiksahni/http-parse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A raw HTTP request parser for Python.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages