MagicStack/httptools is a public repo on GitHub by MagicStack. Fast HTTP parser. It declares the MIT license on GitHub. It is written mainly in Python, has 1,330 stars and last changed on 2026-10-09. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-18.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
httptools is a Python binding for the nodejs HTTP parser.
The package is available on PyPI: pip install httptools.
APIs
httptools contains two classes httptools.HttpRequestParser,
httptools.HttpResponseParser (fulfilled through
llhttp) and a function for
parsing URLs httptools.parse_url (through
http-parse for now).
See unittests for examples.
classHttpRequestParser:
def__init__(self, protocol):
"""HttpRequestParser protocol -- a Python object with the following methods (all optional): - on_message_begin() - on_url(url: bytes) - on_header(name: bytes, value: bytes) - on_headers_complete() - on_body(body: bytes) - on_message_complete() - on_chunk_header() - on_chunk_complete() - on_status(status: bytes) """defget_http_version(self) ->str:
"""Return an HTTP protocol version."""defshould_keep_alive(self) ->bool:
"""Return ``True`` if keep-alive mode is preferred."""defshould_upgrade(self) ->bool:
"""Return ``True`` if the parsed request is a valid Upgrade request. The method exposes a flag set just before on_headers_complete. Calling this method earlier will only yield `False`. """deffeed_data(self, data: bytes):
"""Feed data to the parser. Will eventually trigger callbacks on the ``protocol`` object. On HTTP upgrade, this method will raise an ``HttpParserUpgrade`` exception, with its sole argument set to the offset of the non-HTTP data in ``data``. """defget_method(self) ->bytes:
"""Return HTTP request method (GET, HEAD, etc)"""classHttpResponseParser:
"""Has all methods except ``get_method()`` that HttpRequestParser has."""defget_status_code(self) ->int:
"""Return the status code of the HTTP response"""defparse_url(url: bytes):
"""Parse URL strings into a structured Python object. Returns an instance of ``httptools.URL`` class with the following attributes: - schema: bytes - host: bytes - port: int - path: bytes - query: bytes - fragment: bytes - userinfo: bytes """
Development
Clone this repository with
git clone --recursive git@github.com:MagicStack/httptools.git
Create a virtual environment with Python 3:
python3 -m venv envname
Activate the environment with source envname/bin/activate
Run make and make test.
License
MIT.
Questions
What is httptools?
MagicStack/httptools is a public repo on GitHub by MagicStack. Fast HTTP parser.
Is httptools open source?
It declares the MIT license on GitHub.
Does httptools run on macOS, Windows or Linux?
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
How do I install httptools?
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Is httptools still maintained?
Its last change on GitHub was on 2026-10-09. Take My Repo does not judge from that whether it is maintained.
What do people who ran httptools say?
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.