Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Collection of tools to parse, manipulate, and compile raw HTTP messages.

Project description

httpsuite is a collection of tools to parse, manipulate, and compile raw HTTP messages. Built to be used as a dependency for larger projects that require parsing, modifying, requesting, and responding to raw HTTP requests.


pip install httpsuite

This package was intentionally built to have no external dependencies outside of the Python Standard Library. If you plan on contribute, then make sure to install the dev-requirements.txt.


Read the documentation here.


httpsuite provides two main objects, Request and Response. Both objects can be initialized with either __init__ or parse:

from httpsuite import Request, Response
import json

request = Request(
    headers={"Host": "", "Connection": "keep-alive",},
    body=json.dumps({"hello": "world"}),

response = Response(
    headers={"Host": "", "Connection": "keep-alive",},
    body=json.dumps({"hello": "world"}),


from httpsuite import Request, Response

request = Request.parse(
        b"GET / HTTP/1.1\r\n"
        b"Connection: keep-alive\r\n"
        b'{"hello": "world"}'

response = Response.parse(
        b"HTTP/1.1 200 OK\r\n"
        b"Connection: keep-alive\r\n"
        b'{"hello": "world"}'

Request and Responses objects can be directly modified as one would expect, with no limitations as to the type:

request.method = "POST"
request.headers += {"Accept": "*/*"}

response.status = 100
response.status_msg = b"Continue"

Internally, every item of a request or response is saved as an Item, a special object type that allows easy setting and comparisons on the fly:

response.status == 100      # >>> True
response.status == "100"    # >>> True
response.status == b"100"   # >>> True

Once the object is modified to the users preference, utilizing the Request and Response object is as easy as calling a property (specifically .raw):

# >>> b'POST / HTTP/1.1\r\nHost:\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n{"hello": "world"}'

# >>> b'HTTP/1.1 100 Continue\r\nHost:\r\nConnection: keep-alive\r\n\r\n{"hello": "world"}'

Uniquely, the __str__ method for Request and Response return the objects with arrows to make obvious of its type:

→ POST / HTTP/1.1
→ Host:
→ Connection: keep-alive
→ Accept: */*
→ {"hello": "world"}

← HTTP/1.1 100 Continue
← Host:
← Connection: keep-alive
← {"hello": "world"}

For more information and examples of httpsuite, check out the docs.

Project details

Download files

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

Files for httpsuite, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size httpsuite-1.0.1.tar.gz (14.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page