Name | nh3 JSON |
Version |
0.2.18
JSON |
| download |
home_page | None |
Summary | Python bindings to the ammonia HTML sanitization library. |
upload_time | 2024-07-07 04:27:26 |
maintainer | None |
docs_url | None |
author | messense <messense@icloud.com> |
requires_python | None |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# nh3
![CI](https://github.com/messense/nh3/workflows/CI/badge.svg)
[![PyPI](https://img.shields.io/pypi/v/nh3.svg)](https://pypi.org/project/nh3)
[![Documentation Status](https://readthedocs.org/projects/nh3/badge/?version=latest)](https://nh3.readthedocs.io/en/latest/?badge=latest)
Python bindings to the [ammonia](https://github.com/rust-ammonia/ammonia) HTML sanitization library.
## Installation
```bash
pip install nh3
```
## Usage
See [the documentation](https://nh3.readthedocs.io/en/latest/).
## Performance
A quick benchmark showing that nh3 is about 20 times faster than the deprecated [bleach](https://pypi.org/project/bleach/) package.
Measured on a MacBook Air (M2, 2022).
```ipython
Python 3.11.0 (main, Oct 25 2022, 16:25:24) [Clang 14.0.0 (clang-1400.0.29.102)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.9.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import requests
In [2]: import bleach
In [3]: import nh3
In [4]: html = requests.get("https://www.google.com").text
In [5]: %timeit bleach.clean(html)
2.85 ms ± 22.8 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
In [6]: %timeit nh3.clean(html)
138 µs ± 860 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)
```
## License
This work is released under the MIT license. A copy of the license is provided in the [LICENSE](./LICENSE) file.
Raw data
{
"_id": null,
"home_page": null,
"name": "nh3",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "messense <messense@icloud.com>",
"author_email": "messense <messense@icloud.com>",
"download_url": "https://files.pythonhosted.org/packages/62/73/10df50b42ddb547a907deeb2f3c9823022580a7a47281e8eae8e003a9639/nh3-0.2.18.tar.gz",
"platform": null,
"description": "# nh3\n\n![CI](https://github.com/messense/nh3/workflows/CI/badge.svg)\n[![PyPI](https://img.shields.io/pypi/v/nh3.svg)](https://pypi.org/project/nh3)\n[![Documentation Status](https://readthedocs.org/projects/nh3/badge/?version=latest)](https://nh3.readthedocs.io/en/latest/?badge=latest)\n\nPython bindings to the [ammonia](https://github.com/rust-ammonia/ammonia) HTML sanitization library.\n\n## Installation\n\n```bash\npip install nh3\n```\n\n## Usage\n\nSee [the documentation](https://nh3.readthedocs.io/en/latest/).\n\n## Performance\n\nA quick benchmark showing that nh3 is about 20 times faster than the deprecated [bleach](https://pypi.org/project/bleach/) package.\nMeasured on a MacBook Air (M2, 2022).\n\n```ipython\nPython 3.11.0 (main, Oct 25 2022, 16:25:24) [Clang 14.0.0 (clang-1400.0.29.102)]\nType 'copyright', 'credits' or 'license' for more information\nIPython 8.9.0 -- An enhanced Interactive Python. Type '?' for help.\n\nIn [1]: import requests\n\nIn [2]: import bleach\n\nIn [3]: import nh3\n\nIn [4]: html = requests.get(\"https://www.google.com\").text\n\nIn [5]: %timeit bleach.clean(html)\n2.85 ms \u00b1 22.8 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 100 loops each)\n\nIn [6]: %timeit nh3.clean(html)\n138 \u00b5s \u00b1 860 ns per loop (mean \u00b1 std. dev. of 7 runs, 10,000 loops each)\n```\n\n## License\n\nThis work is released under the MIT license. A copy of the license is provided in the [LICENSE](./LICENSE) file.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python bindings to the ammonia HTML sanitization library.",
"version": "0.2.18",
"project_urls": {
"Source Code": "https://github.com/messense/nh3"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b3891daff5d9ba5a95a157c092c7c5f39b8dd2b1ddb4559966f808d31cfb67e0",
"md5": "81c8ef49a13c7b243ef609e280ac2650",
"sha256": "14c5a72e9fe82aea5fe3072116ad4661af5cf8e8ff8fc5ad3450f123e4925e86"
},
"downloads": -1,
"filename": "nh3-0.2.18-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl",
"has_sig": false,
"md5_digest": "81c8ef49a13c7b243ef609e280ac2650",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 1374474,
"upload_time": "2024-07-07T04:27:01",
"upload_time_iso_8601": "2024-07-07T04:27:01.210572Z",
"url": "https://files.pythonhosted.org/packages/b3/89/1daff5d9ba5a95a157c092c7c5f39b8dd2b1ddb4559966f808d31cfb67e0/nh3-0.2.18-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2cb642fc3c69cabf86b6b81e4c051a9b6e249c5ba9f8155590222c2622961f58",
"md5": "9440409532962ed10fdcbe6d8c83471b",
"sha256": "7b7c2a3c9eb1a827d42539aa64091640bd275b81e097cd1d8d82ef91ffa2e811"
},
"downloads": -1,
"filename": "nh3-0.2.18-cp37-abi3-macosx_10_12_x86_64.whl",
"has_sig": false,
"md5_digest": "9440409532962ed10fdcbe6d8c83471b",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 694573,
"upload_time": "2024-07-07T04:27:03",
"upload_time_iso_8601": "2024-07-07T04:27:03.300621Z",
"url": "https://files.pythonhosted.org/packages/2c/b6/42fc3c69cabf86b6b81e4c051a9b6e249c5ba9f8155590222c2622961f58/nh3-0.2.18-cp37-abi3-macosx_10_12_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "45b9833f385403abaf0023c6547389ec7a7acf141ddd9d1f21573723a6eab39a",
"md5": "1151483fc67a31e81a7efb87a84bbd90",
"sha256": "42c64511469005058cd17cc1537578eac40ae9f7200bedcfd1fc1a05f4f8c200"
},
"downloads": -1,
"filename": "nh3-0.2.18-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "1151483fc67a31e81a7efb87a84bbd90",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 844082,
"upload_time": "2024-07-07T04:27:05",
"upload_time_iso_8601": "2024-07-07T04:27:05.036256Z",
"url": "https://files.pythonhosted.org/packages/45/b9/833f385403abaf0023c6547389ec7a7acf141ddd9d1f21573723a6eab39a/nh3-0.2.18-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "052b85977d9e11713b5747595ee61f381bc820749daf83f07b90b6c9964cf932",
"md5": "9bdef8a07a7d9ef0fe1368a072ad8a03",
"sha256": "0411beb0589eacb6734f28d5497ca2ed379eafab8ad8c84b31bb5c34072b7164"
},
"downloads": -1,
"filename": "nh3-0.2.18-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl",
"has_sig": false,
"md5_digest": "9bdef8a07a7d9ef0fe1368a072ad8a03",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 782460,
"upload_time": "2024-07-07T04:27:06",
"upload_time_iso_8601": "2024-07-07T04:27:06.797483Z",
"url": "https://files.pythonhosted.org/packages/05/2b/85977d9e11713b5747595ee61f381bc820749daf83f07b90b6c9964cf932/nh3-0.2.18-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "aba7375afcc710dbe2d64cfbd69e31f82f3e423d43737258af01f6a56d844085",
"md5": "0cf11c40b58072ad14598e969b0708db",
"sha256": "34c03fa78e328c691f982b7c03d4423bdfd7da69cd707fe572f544cf74ac23ad"
},
"downloads": -1,
"filename": "nh3-0.2.18-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl",
"has_sig": false,
"md5_digest": "0cf11c40b58072ad14598e969b0708db",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 841080,
"upload_time": "2024-07-07T04:27:09",
"upload_time_iso_8601": "2024-07-07T04:27:09.668867Z",
"url": "https://files.pythonhosted.org/packages/ab/a7/375afcc710dbe2d64cfbd69e31f82f3e423d43737258af01f6a56d844085/nh3-0.2.18-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "72f25c894d5265ab80a97c68ca36f25c8f6f0308abac649aaf152b74e7e854a8",
"md5": "ad23f6f8878ee30e3f9ecf8b3ce2c8ae",
"sha256": "5f36b271dae35c465ef5e9090e1fdaba4a60a56f0bb0ba03e0932a66f28b9189"
},
"downloads": -1,
"filename": "nh3-0.2.18-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl",
"has_sig": false,
"md5_digest": "ad23f6f8878ee30e3f9ecf8b3ce2c8ae",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 879827,
"upload_time": "2024-07-07T04:27:08",
"upload_time_iso_8601": "2024-07-07T04:27:08.372979Z",
"url": "https://files.pythonhosted.org/packages/72/f2/5c894d5265ab80a97c68ca36f25c8f6f0308abac649aaf152b74e7e854a8/nh3-0.2.18-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c2a83bb02d0c60a03ad3a112b76c46971e9480efa98a8946677b5a59f60130ca",
"md5": "4c47f5a5c7d7d98f3a2d9d2fc40dca46",
"sha256": "19aaba96e0f795bd0a6c56291495ff59364f4300d4a39b29a0abc9cb3774a84b"
},
"downloads": -1,
"filename": "nh3-0.2.18-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl",
"has_sig": false,
"md5_digest": "4c47f5a5c7d7d98f3a2d9d2fc40dca46",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 924144,
"upload_time": "2024-07-07T04:27:11",
"upload_time_iso_8601": "2024-07-07T04:27:11.456498Z",
"url": "https://files.pythonhosted.org/packages/c2/a8/3bb02d0c60a03ad3a112b76c46971e9480efa98a8946677b5a59f60130ca/nh3-0.2.18-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1b636ab90d0e5225ab9780f6c9fb52254fa36b52bb7c188df9201d05b647e5e1",
"md5": "ebefb18c09e91b3a43423c7f62d80ff4",
"sha256": "de3ceed6e661954871d6cd78b410213bdcb136f79aafe22aa7182e028b8c7307"
},
"downloads": -1,
"filename": "nh3-0.2.18-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "ebefb18c09e91b3a43423c7f62d80ff4",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 769192,
"upload_time": "2024-07-07T04:27:13",
"upload_time_iso_8601": "2024-07-07T04:27:13.153772Z",
"url": "https://files.pythonhosted.org/packages/1b/63/6ab90d0e5225ab9780f6c9fb52254fa36b52bb7c188df9201d05b647e5e1/nh3-0.2.18-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a41759391c28580e2c32272761629893e761442fc7666da0b1cdb479f3b67b88",
"md5": "c52734e8f63f4792ef907887805bd8ea",
"sha256": "6955369e4d9f48f41e3f238a9e60f9410645db7e07435e62c6a9ea6135a4907f"
},
"downloads": -1,
"filename": "nh3-0.2.18-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl",
"has_sig": false,
"md5_digest": "c52734e8f63f4792ef907887805bd8ea",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 791042,
"upload_time": "2024-07-07T04:27:14",
"upload_time_iso_8601": "2024-07-07T04:27:14.938324Z",
"url": "https://files.pythonhosted.org/packages/a4/17/59391c28580e2c32272761629893e761442fc7666da0b1cdb479f3b67b88/nh3-0.2.18-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a3da0c4e282bc3cff4a0adf37005fa1fb42257673fbc1bbf7d1ff639ec3d255a",
"md5": "e07af13784b0d70cf88b36976c6e7f99",
"sha256": "f0eca9ca8628dbb4e916ae2491d72957fdd35f7a5d326b7032a345f111ac07fe"
},
"downloads": -1,
"filename": "nh3-0.2.18-cp37-abi3-musllinux_1_2_aarch64.whl",
"has_sig": false,
"md5_digest": "e07af13784b0d70cf88b36976c6e7f99",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 1010073,
"upload_time": "2024-07-07T04:27:16",
"upload_time_iso_8601": "2024-07-07T04:27:16.830826Z",
"url": "https://files.pythonhosted.org/packages/a3/da/0c4e282bc3cff4a0adf37005fa1fb42257673fbc1bbf7d1ff639ec3d255a/nh3-0.2.18-cp37-abi3-musllinux_1_2_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "de81c291231463d21da5f8bba82c8167a6d6893cc5419b0639801ee5d3aeb8a9",
"md5": "848853dffa722e97685cbca8e8e5055c",
"sha256": "3a157ab149e591bb638a55c8c6bcb8cdb559c8b12c13a8affaba6cedfe51713a"
},
"downloads": -1,
"filename": "nh3-0.2.18-cp37-abi3-musllinux_1_2_armv7l.whl",
"has_sig": false,
"md5_digest": "848853dffa722e97685cbca8e8e5055c",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 1029782,
"upload_time": "2024-07-07T04:27:18",
"upload_time_iso_8601": "2024-07-07T04:27:18.641268Z",
"url": "https://files.pythonhosted.org/packages/de/81/c291231463d21da5f8bba82c8167a6d6893cc5419b0639801ee5d3aeb8a9/nh3-0.2.18-cp37-abi3-musllinux_1_2_armv7l.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "631d842fed85cf66c973be0aed8770093d6a04741f65e2c388ddd4c07fd3296e",
"md5": "58ff8b9859426e242ff7feaa58659935",
"sha256": "c8b3a1cebcba9b3669ed1a84cc65bf005728d2f0bc1ed2a6594a992e817f3a50"
},
"downloads": -1,
"filename": "nh3-0.2.18-cp37-abi3-musllinux_1_2_i686.whl",
"has_sig": false,
"md5_digest": "58ff8b9859426e242ff7feaa58659935",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 942504,
"upload_time": "2024-07-07T04:27:20",
"upload_time_iso_8601": "2024-07-07T04:27:20.563339Z",
"url": "https://files.pythonhosted.org/packages/63/1d/842fed85cf66c973be0aed8770093d6a04741f65e2c388ddd4c07fd3296e/nh3-0.2.18-cp37-abi3-musllinux_1_2_i686.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "eb6173a007c74c37895fdf66e0edcd881f5eaa17a348ff02f4bb4bc906d61085",
"md5": "3f5bf7787842a72d44df056e59183854",
"sha256": "36c95d4b70530b320b365659bb5034341316e6a9b30f0b25fa9c9eff4c27a204"
},
"downloads": -1,
"filename": "nh3-0.2.18-cp37-abi3-musllinux_1_2_x86_64.whl",
"has_sig": false,
"md5_digest": "3f5bf7787842a72d44df056e59183854",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 941541,
"upload_time": "2024-07-07T04:27:22",
"upload_time_iso_8601": "2024-07-07T04:27:22.280404Z",
"url": "https://files.pythonhosted.org/packages/eb/61/73a007c74c37895fdf66e0edcd881f5eaa17a348ff02f4bb4bc906d61085/nh3-0.2.18-cp37-abi3-musllinux_1_2_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "784854a788fc9428e481b2f58e0cd8564f6c74ffb6e9ef73d39e8acbeae8c629",
"md5": "e62eca0ffab5e1a79a18e82cb1e9bc65",
"sha256": "a7f1b5b2c15866f2db413a3649a8fe4fd7b428ae58be2c0f6bca5eefd53ca2be"
},
"downloads": -1,
"filename": "nh3-0.2.18-cp37-abi3-win32.whl",
"has_sig": false,
"md5_digest": "e62eca0ffab5e1a79a18e82cb1e9bc65",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 573750,
"upload_time": "2024-07-07T04:27:23",
"upload_time_iso_8601": "2024-07-07T04:27:23.655773Z",
"url": "https://files.pythonhosted.org/packages/78/48/54a788fc9428e481b2f58e0cd8564f6c74ffb6e9ef73d39e8acbeae8c629/nh3-0.2.18-cp37-abi3-win32.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "268d53c5b19c4999bdc6ba95f246f4ef35ca83d7d7423e5e38be43ad66544e5d",
"md5": "97ff3c621b47a9403e494acbda216992",
"sha256": "8ce0f819d2f1933953fca255db2471ad58184a60508f03e6285e5114b6254844"
},
"downloads": -1,
"filename": "nh3-0.2.18-cp37-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "97ff3c621b47a9403e494acbda216992",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 579012,
"upload_time": "2024-07-07T04:27:24",
"upload_time_iso_8601": "2024-07-07T04:27:24.905375Z",
"url": "https://files.pythonhosted.org/packages/26/8d/53c5b19c4999bdc6ba95f246f4ef35ca83d7d7423e5e38be43ad66544e5d/nh3-0.2.18-cp37-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "627310df50b42ddb547a907deeb2f3c9823022580a7a47281e8eae8e003a9639",
"md5": "cda29ff819430f0a05c5fe5a1ad15f04",
"sha256": "94a166927e53972a9698af9542ace4e38b9de50c34352b962f4d9a7d4c927af4"
},
"downloads": -1,
"filename": "nh3-0.2.18.tar.gz",
"has_sig": false,
"md5_digest": "cda29ff819430f0a05c5fe5a1ad15f04",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 15028,
"upload_time": "2024-07-07T04:27:26",
"upload_time_iso_8601": "2024-07-07T04:27:26.670653Z",
"url": "https://files.pythonhosted.org/packages/62/73/10df50b42ddb547a907deeb2f3c9823022580a7a47281e8eae8e003a9639/nh3-0.2.18.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-07 04:27:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "messense",
"github_project": "nh3",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nh3"
}