{ "info": { "author": "Yury Selivanov", "author_email": "yury@magic.io", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX", "Programming Language :: Python :: 3" ], "description": "[![Build Status](https://travis-ci.org/MagicStack/httptools.svg?branch=master)](https://travis-ci.org/MagicStack/httptools)\n\nhttptools is a Python binding for nodejs HTTP parser. It's still in a\nvery early development stage, expect APIs to break.\n\nThe package is available on PyPI: `pip install httptools`.\n\n\n# APIs\n\nhttptools contains two classes `httptools.HttpRequestParser`,\n`httptools.HttpResponseParser` and a function for parsing URLs\n`httptools.parse_url`. See unittests for examples.\n\n\n```python\n\nclass HttpRequestParser:\n\n def __init__(self, protocol):\n \"\"\"HttpRequestParser\n\n protocol -- a Python object with the following methods\n (all optional):\n\n - on_message_begin()\n - on_url(url: bytes)\n - on_header(name: bytes, value: bytes)\n - on_headers_complete()\n - on_body(body: bytes)\n - on_message_complete()\n - on_chunk_header()\n - on_chunk_complete()\n - on_status(status: bytes)\n \"\"\"\n\n def get_http_version(self) -> str:\n \"\"\"Return an HTTP protocol version.\"\"\"\n\n def should_keep_alive(self) -> bool:\n \"\"\"Return ``True`` if keep-alive mode is preferred.\"\"\"\n\n def should_upgrade(self) -> bool:\n \"\"\"Return ``True`` if the parsed request is a valid Upgrade request.\n\tThe method exposes a flag set just before on_headers_complete.\n\tCalling this method earlier will only yield `False`.\n\t\"\"\"\n\n def feed_data(self, data: bytes):\n \"\"\"Feed data to the parser.\n\n Will eventually trigger callbacks on the ``protocol``\n object.\n\n On HTTP upgrade, this method will raise an\n ``HttpParserUpgrade`` exception, with its sole argument\n set to the offset of the non-HTTP data in ``data``.\n \"\"\"\n\n def get_method(self) -> bytes:\n \"\"\"Return HTTP request method (GET, HEAD, etc)\"\"\"\n\n\nclass HttpResponseParser:\n\n \"\"\"Has all methods except ``get_method()`` that\n HttpRequestParser has.\"\"\"\n\n def get_status_code(self) -> int:\n \"\"\"Return the status code of the HTTP response\"\"\"\n\n\ndef parse_url(url: bytes):\n \"\"\"Parse URL strings into a structured Python object.\n\n Returns an instance of ``httptools.URL`` class with the\n following attributes:\n\n - schema: bytes\n - host: bytes\n - port: int\n - path: bytes\n - query: bytes\n - fragment: bytes\n - userinfo: bytes\n \"\"\"\n```\n\n\n# Development\n\n1. Clone this repository with\n `git clone --recursive git@github.com:MagicStack/httptools.git`\n\n2. Create a virtual environment with Python 3.5:\n `python3.5 -m venv envname`\n\n3. Activate the environment with `source envname/bin/activate`\n\n4. Install Cython with `pip install cython`\n\n5. Run `make` and `make test`.\n\n\n# License\n\nMIT.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/MagicStack/httptools", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "httptools", "package_url": "https://pypi.org/project/httptools/", "platform": "POSIX", "project_url": "https://pypi.org/project/httptools/", "project_urls": { "Homepage": "https://github.com/MagicStack/httptools" }, "release_url": "https://pypi.org/project/httptools/0.0.13/", "requires_dist": null, "requires_python": "", "summary": "A collection of framework independent HTTP protocol utils.", "version": "0.0.13" }, "last_serial": 4866383, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "a292badb19576dfa9b505068993d936f", "sha256": "13a1e1706fd2bc0b603100b1898d3b7c6291fc88eabbf8999bd42635e92aca11" }, "downloads": -1, "filename": "httptools-0.0.1.tar.gz", "has_sig": false, "md5_digest": "a292badb19576dfa9b505068993d936f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 77402, "upload_time": "2015-10-29T20:30:47", "url": "https://files.pythonhosted.org/packages/87/7e/d7a441fb3340ebf394fac91b29c435df98cf7e2419ecded52d9fb95d6950/httptools-0.0.1.tar.gz" } ], "0.0.10": [ { "comment_text": "", "digests": { "md5": "e24ef572c5e46ae008734c35329c50fc", "sha256": "f50dcb27178416c3a4113e9e1b392be5d1ff56ae1e474fe80869ed8530505e4c" }, "downloads": -1, "filename": "httptools-0.0.10.tar.gz", "has_sig": false, "md5_digest": "e24ef572c5e46ae008734c35329c50fc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 98344, "upload_time": "2017-12-15T21:36:53", "url": "https://files.pythonhosted.org/packages/82/21/7a987112425f0b6111cf9a3750939ffb51fc8cf4e07d54819df18a2e134e/httptools-0.0.10.tar.gz" } ], "0.0.11": [ { "comment_text": "", "digests": { "md5": "ad102a0633dc916d09f3582f03acf15a", "sha256": "04c7703bbef0e8ca28b09811547352b8c7c20549eab70dc24e536bb24fd2b7c5" }, "downloads": -1, "filename": "httptools-0.0.11.tar.gz", "has_sig": false, "md5_digest": "ad102a0633dc916d09f3582f03acf15a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 99918, "upload_time": "2018-03-29T16:09:27", "url": "https://files.pythonhosted.org/packages/a3/75/40cdb732e8ef547d9f34ceb83c43ea7188c0ffb719ddc6a1ad160464292d/httptools-0.0.11.tar.gz" } ], "0.0.12": [ { "comment_text": "", "digests": { "md5": "c9121828c8a8e382c0f566be118291d5", "sha256": "6d41d6f3cf2dd122125c1e805d69b2f2cf3d8db2928429f1a16e604e6ac4bf7b" }, "downloads": -1, "filename": "httptools-0.0.12.tar.gz", "has_sig": false, "md5_digest": "c9121828c8a8e382c0f566be118291d5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 103988, "upload_time": "2019-02-25T19:49:39", "url": "https://files.pythonhosted.org/packages/54/5d/caf3d090577c3e7b69779103fab0d78ac33447ac497a2d2f3b97f624e6bf/httptools-0.0.12.tar.gz" } ], "0.0.13": [ { "comment_text": "", "digests": { "md5": "802a2808a5a7a41f44bc8aa7a6d2465d", "sha256": "e00cbd7ba01ff748e494248183abc6e153f49181169d8a3d41bb49132ca01dfc" }, "downloads": -1, "filename": "httptools-0.0.13.tar.gz", "has_sig": false, "md5_digest": "802a2808a5a7a41f44bc8aa7a6d2465d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 104152, "upload_time": "2019-02-25T19:56:07", "url": "https://files.pythonhosted.org/packages/1b/03/215969db11abe8741e9c266a4cbe803a372bd86dd35fa0084c4df6d4bd00/httptools-0.0.13.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "609bfa7138ccb290e06799ec36c14208", "sha256": "6b5ef799a2d5fc7bebe737d08801557a75d918e2029c1356dbbf2d6b0af1be38" }, "downloads": -1, "filename": "httptools-0.0.2.tar.gz", "has_sig": false, "md5_digest": "609bfa7138ccb290e06799ec36c14208", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 75158, "upload_time": "2015-10-30T19:27:16", "url": "https://files.pythonhosted.org/packages/a8/ab/38cdc6a9c4af08b80001c866b2ed1aa7295681ddec05ef27bd7745878eab/httptools-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "f463f5c72b2a2f720b315bd1e57cd958", "sha256": "a17c300145fa444d86802694174428f8c5f556e44d9edee6a263116f8b3a18b2" }, "downloads": -1, "filename": "httptools-0.0.3.tar.gz", "has_sig": false, "md5_digest": "f463f5c72b2a2f720b315bd1e57cd958", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 82374, "upload_time": "2015-10-30T21:28:04", "url": "https://files.pythonhosted.org/packages/92/58/94809071bc864c32720d91ecbe16de69bfc35c5cf2a35019bab11f9eaeb5/httptools-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "9e850a6747f18964be0c26f11e949e8b", "sha256": "ef8451cbbf324b4974ba9672f6a8e69e9714579016c05552da9f08d12b234d26" }, "downloads": -1, "filename": "httptools-0.0.4.tar.gz", "has_sig": false, "md5_digest": "9e850a6747f18964be0c26f11e949e8b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 81260, "upload_time": "2016-04-25T16:12:09", "url": "https://files.pythonhosted.org/packages/25/17/22ae0558801fd978f60cc889f6b1b44c0ae48e562bf7b42d66b411855e4b/httptools-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "ba0b33ca5db03b4d834037c5be940421", "sha256": "cd3b057dbf259c3485b9293a559b353ad46472921fb4c1f15f0ca455724b78a6" }, "downloads": -1, "filename": "httptools-0.0.5.tar.gz", "has_sig": false, "md5_digest": "ba0b33ca5db03b4d834037c5be940421", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 81280, "upload_time": "2016-04-27T21:12:46", "url": "https://files.pythonhosted.org/packages/40/d5/36d3b13da4acc6d5699e3e9193e45813c73e6f30852bc29a4061d10782df/httptools-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "8d8aac21036abcdbcfeec79c4aa2c80d", "sha256": "ba2c3208f4442018f944f36f6786dac8b4394d6ebdf5fcc2d48c5e0840a4e557" }, "downloads": -1, "filename": "httptools-0.0.6.tar.gz", "has_sig": false, "md5_digest": "8d8aac21036abcdbcfeec79c4aa2c80d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 83686, "upload_time": "2016-05-07T00:49:23", "url": "https://files.pythonhosted.org/packages/7a/dd/58d6800eb713d15ee4aa6d6ed733d14ced6046ac5f1429842c6c1c0cf1b6/httptools-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "4c904f5214e2ba273443a00501a113b2", "sha256": "65a4fb5d827fe3387b10504ac7d668989f6255ae4bfa16b3b47478adb0d5fa17" }, "downloads": -1, "filename": "httptools-0.0.7.tar.gz", "has_sig": false, "md5_digest": "4c904f5214e2ba273443a00501a113b2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 83904, "upload_time": "2016-05-07T01:51:20", "url": "https://files.pythonhosted.org/packages/2c/6e/7620504418e5c540647a8baa4ffc5833a33aabdd2b7da68d5c7019ebb7ce/httptools-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "a16838b8d9e1619fbd3cf907564c9b59", "sha256": "8055f186349678c12e749b2ca12458c14732797e1ff6f39ed98c2f596518e4e2" }, "downloads": -1, "filename": "httptools-0.0.8.tar.gz", "has_sig": false, "md5_digest": "a16838b8d9e1619fbd3cf907564c9b59", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 83965, "upload_time": "2016-05-07T02:12:41", "url": "https://files.pythonhosted.org/packages/36/07/f63e9bbda2ea1d87a946e4d791f6bd479f53a24cd28a21c4704fdc914621/httptools-0.0.8.tar.gz" } ], "0.0.9": [ { "comment_text": "", "digests": { "md5": "97cf5e61ce91bbe5cc0a9e51767befa2", "sha256": "f47f9870f19e3488e8def0898c46f87d36e5d59e90eb77d01453a6747cdab9f8" }, "downloads": -1, "filename": "httptools-0.0.9.tar.gz", "has_sig": false, "md5_digest": "97cf5e61ce91bbe5cc0a9e51767befa2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 86581, "upload_time": "2016-05-08T17:32:13", "url": "https://files.pythonhosted.org/packages/09/a6/9c2bc8d96a06613e32e5b1dc74299dea24cecf6856cb2db8a05b13a24546/httptools-0.0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "802a2808a5a7a41f44bc8aa7a6d2465d", "sha256": "e00cbd7ba01ff748e494248183abc6e153f49181169d8a3d41bb49132ca01dfc" }, "downloads": -1, "filename": "httptools-0.0.13.tar.gz", "has_sig": false, "md5_digest": "802a2808a5a7a41f44bc8aa7a6d2465d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 104152, "upload_time": "2019-02-25T19:56:07", "url": "https://files.pythonhosted.org/packages/1b/03/215969db11abe8741e9c266a4cbe803a372bd86dd35fa0084c4df6d4bd00/httptools-0.0.13.tar.gz" } ] }