From be68ce6a6a8c0334787a6e9594cfff60a492567e Mon Sep 17 00:00:00 2001 From: Polina Date: Thu, 2 Jul 2026 18:34:57 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20=C2=AB?= =?UTF-8?q?venv/Lib/site-packages/httptools-0.8.0.dist-info=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../httptools-0.8.0.dist-info/INSTALLER | 1 + .../httptools-0.8.0.dist-info/METADATA | 131 ++++++++++++++++++ .../httptools-0.8.0.dist-info/RECORD | 28 ++++ .../httptools-0.8.0.dist-info/WHEEL | 5 + .../httptools-0.8.0.dist-info/top_level.txt | 1 + 5 files changed, 166 insertions(+) create mode 100644 venv/Lib/site-packages/httptools-0.8.0.dist-info/INSTALLER create mode 100644 venv/Lib/site-packages/httptools-0.8.0.dist-info/METADATA create mode 100644 venv/Lib/site-packages/httptools-0.8.0.dist-info/RECORD create mode 100644 venv/Lib/site-packages/httptools-0.8.0.dist-info/WHEEL create mode 100644 venv/Lib/site-packages/httptools-0.8.0.dist-info/top_level.txt diff --git a/venv/Lib/site-packages/httptools-0.8.0.dist-info/INSTALLER b/venv/Lib/site-packages/httptools-0.8.0.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/venv/Lib/site-packages/httptools-0.8.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/venv/Lib/site-packages/httptools-0.8.0.dist-info/METADATA b/venv/Lib/site-packages/httptools-0.8.0.dist-info/METADATA new file mode 100644 index 0000000..1e89d3e --- /dev/null +++ b/venv/Lib/site-packages/httptools-0.8.0.dist-info/METADATA @@ -0,0 +1,131 @@ +Metadata-Version: 2.4 +Name: httptools +Version: 0.8.0 +Summary: A collection of framework independent HTTP protocol utils. +Author-email: Yury Selivanov +License-Expression: MIT +Project-URL: Homepage, https://github.com/MagicStack/httptools +Platform: macOS +Platform: POSIX +Platform: Windows +Classifier: Intended Audience :: Developers +Classifier: Programming Language :: Python :: 3 +Classifier: Operating System :: POSIX +Classifier: Operating System :: MacOS :: MacOS X +Classifier: Environment :: Web Environment +Classifier: Development Status :: 5 - Production/Stable +Requires-Python: >=3.9 +Description-Content-Type: text/markdown +License-File: LICENSE +License-File: vendor/http-parser/LICENSE-MIT +License-File: vendor/llhttp/LICENSE +Dynamic: license-file +Dynamic: platform + +![Tests](https://github.com/MagicStack/httptools/workflows/Tests/badge.svg) + +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](https://github.com/nodejs/llhttp)) and a function for +parsing URLs `httptools.parse_url` (through +[http-parse](https://github.com/nodejs/http-parser) for now). +See unittests for examples. + + +```python + +class HttpRequestParser: + + 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) + """ + + def get_http_version(self) -> str: + """Return an HTTP protocol version.""" + + def should_keep_alive(self) -> bool: + """Return ``True`` if keep-alive mode is preferred.""" + + def should_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`. + """ + + def feed_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``. + """ + + def get_method(self) -> bytes: + """Return HTTP request method (GET, HEAD, etc)""" + + +class HttpResponseParser: + + """Has all methods except ``get_method()`` that + HttpRequestParser has.""" + + def get_status_code(self) -> int: + """Return the status code of the HTTP response""" + + +def parse_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 + +1. Clone this repository with + `git clone --recursive git@github.com:MagicStack/httptools.git` + +2. Create a virtual environment with Python 3: + `python3 -m venv envname` + +3. Activate the environment with `source envname/bin/activate` + +4. Run `make` and `make test`. + + +# License + +MIT. diff --git a/venv/Lib/site-packages/httptools-0.8.0.dist-info/RECORD b/venv/Lib/site-packages/httptools-0.8.0.dist-info/RECORD new file mode 100644 index 0000000..c71ab49 --- /dev/null +++ b/venv/Lib/site-packages/httptools-0.8.0.dist-info/RECORD @@ -0,0 +1,28 @@ +httptools-0.8.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +httptools-0.8.0.dist-info/METADATA,sha256=4rBEKetR3NrzjzwCpmMX5YI0eTFD7h6tybgZiCEEAOY,3663 +httptools-0.8.0.dist-info/RECORD,, +httptools-0.8.0.dist-info/WHEEL,sha256=jhxrRP3tdEfm7toB1X7dl5x6f0bu6Tve2cWwIdkbL8U,101 +httptools-0.8.0.dist-info/licenses/LICENSE,sha256=HAKLBZ16WOFMzaOMq87WmMWR_mFP--T3IUMERuhsjWk,1114 +httptools-0.8.0.dist-info/licenses/vendor/http-parser/LICENSE-MIT,sha256=XNG2gsDMusDLMbhqmhEEw-LnsTd6KCuBadJpS0ANt8I,1096 +httptools-0.8.0.dist-info/licenses/vendor/llhttp/LICENSE,sha256=J5AS4CoQrP1Zo_LY8TpJczJTXYccKyfImYiYWwajpDg,1091 +httptools-0.8.0.dist-info/top_level.txt,sha256=APjJKTbZcj0OQ4fdgf2eTCk82nK1n2BFXOD7ky41MPY,10 +httptools/__init__.py,sha256=4jrSwXhVO8VMsFde5pRFIRc9IZgT7IqtRHlMJtc1jJw,759 +httptools/__pycache__/__init__.cpython-314.pyc,, +httptools/__pycache__/_version.cpython-314.pyc,, +httptools/_version.py,sha256=N1JaBh8KG5nLIetvXAKqMVo3dslEx-oJoHf65BywhrU,588 +httptools/parser/__init__.py,sha256=XounAcwcwAKDNLWlEdcPv5EKAgMXgpXV7o7A0-twbp8,704 +httptools/parser/__pycache__/__init__.cpython-314.pyc,, +httptools/parser/__pycache__/errors.cpython-314.pyc,, +httptools/parser/__pycache__/protocol.cpython-314.pyc,, +httptools/parser/cparser.pxd,sha256=XOczyt3PFtYc1r-GVKecEkN5zvBD78NXfd2JhyKOKBg,5144 +httptools/parser/errors.py,sha256=fQeEGiZ6AQH7SIa-7uzMs5QggoXr0A8YBPVHmafSw5Q,596 +httptools/parser/parser.cp314-win_amd64.pyd,sha256=p-6-T7xEtP66_XUarE7rugI_jRmYkjXvnIajCLnBA1Q,126464 +httptools/parser/parser.pyi,sha256=ZRhM6dEoqyJNTdMfgw9TVbkUOQCgkgVBlA3bfApV3dE,2215 +httptools/parser/parser.pyx,sha256=jgDH58PbHrXpT4wGDptP02tGsceOo9qHYSJBdpK5ZEs,15576 +httptools/parser/protocol.py,sha256=_NTcrPAY9tFe4tE--Noa9-mEGc8aBnWamFkPDGGKNiU,601 +httptools/parser/python.pxd,sha256=-pIXNLe1u3u3X51ORUUoHRBMsntzRlQa3z2iBqljTHU,144 +httptools/parser/url_cparser.pxd,sha256=rvPJV7S96tTqKMT0Bk4jHgMy2U0rNY5_NsPa7KG5lio,810 +httptools/parser/url_parser.cp314-win_amd64.pyd,sha256=Z1LWfl4_wfvrqtEXse4vMLdP4GSKFvEAuSfiJhiGl3s,52224 +httptools/parser/url_parser.pyi,sha256=hu_X-VBNWIoxf6kOnF0B7Cju0n1VdPwxdkY-Jr4vPRM,305 +httptools/parser/url_parser.pyx,sha256=jzmxvNHzzKTyEgzQZwtx_hhjPXPoENkri-08zwXTkCA,4353 +httptools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 diff --git a/venv/Lib/site-packages/httptools-0.8.0.dist-info/WHEEL b/venv/Lib/site-packages/httptools-0.8.0.dist-info/WHEEL new file mode 100644 index 0000000..a2596f3 --- /dev/null +++ b/venv/Lib/site-packages/httptools-0.8.0.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (82.0.1) +Root-Is-Purelib: false +Tag: cp314-cp314-win_amd64 + diff --git a/venv/Lib/site-packages/httptools-0.8.0.dist-info/top_level.txt b/venv/Lib/site-packages/httptools-0.8.0.dist-info/top_level.txt new file mode 100644 index 0000000..bef3b40 --- /dev/null +++ b/venv/Lib/site-packages/httptools-0.8.0.dist-info/top_level.txt @@ -0,0 +1 @@ +httptools