Name | nh3 JSON |
Version |
0.2.17
JSON |
| download |
home_page | None |
Summary | Python bindings to the ammonia HTML sanitization library. |
upload_time | 2024-03-26 12:11:32 |
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/4b/d2/b14d619582459d2790e0c3338ec6d1611be87fdd5d1dcaca85e6c20eaed3/nh3-0.2.17.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.17",
"project_urls": {
"Source Code": "https://github.com/messense/nh3"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0f4e180c017c9fba59094478068d3743d764ead3132bc910d4619b7e58bccc3c",
"md5": "29b2829723f9fe6210e46279558f5559",
"sha256": "551672fd71d06cd828e282abdb810d1be24e1abb7ae2543a8fa36a71c1006fe9"
},
"downloads": -1,
"filename": "nh3-0.2.17-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl",
"has_sig": false,
"md5_digest": "29b2829723f9fe6210e46279558f5559",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 1359565,
"upload_time": "2024-03-26T12:11:05",
"upload_time_iso_8601": "2024-03-26T12:11:05.692709Z",
"url": "https://files.pythonhosted.org/packages/0f/4e/180c017c9fba59094478068d3743d764ead3132bc910d4619b7e58bccc3c/nh3-0.2.17-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": "07a19c73f4228cb4587ac95fee1652939f420a390e6bd74af61032c871e8d757",
"md5": "c14a5116eedb6fb1be0828ca66efb9d9",
"sha256": "c551eb2a3876e8ff2ac63dff1585236ed5dfec5ffd82216a7a174f7c5082a78a"
},
"downloads": -1,
"filename": "nh3-0.2.17-cp37-abi3-macosx_10_12_x86_64.whl",
"has_sig": false,
"md5_digest": "c14a5116eedb6fb1be0828ca66efb9d9",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 683392,
"upload_time": "2024-03-26T12:11:07",
"upload_time_iso_8601": "2024-03-26T12:11:07.753759Z",
"url": "https://files.pythonhosted.org/packages/07/a1/9c73f4228cb4587ac95fee1652939f420a390e6bd74af61032c871e8d757/nh3-0.2.17-cp37-abi3-macosx_10_12_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "04c85000b81bfa6311c04d8900ae0bc27f2fc0b1c59bd34d807788f22011eda0",
"md5": "719bb638d7bda8771a8adefe2262b6ee",
"sha256": "66f17d78826096291bd264f260213d2b3905e3c7fae6dfc5337d49429f1dc9f3"
},
"downloads": -1,
"filename": "nh3-0.2.17-cp37-abi3-manylinux_2_12_i686.manylinux2010_i686.whl",
"has_sig": false,
"md5_digest": "719bb638d7bda8771a8adefe2262b6ee",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 778818,
"upload_time": "2024-03-26T12:11:09",
"upload_time_iso_8601": "2024-03-26T12:11:09.785222Z",
"url": "https://files.pythonhosted.org/packages/04/c8/5000b81bfa6311c04d8900ae0bc27f2fc0b1c59bd34d807788f22011eda0/nh3-0.2.17-cp37-abi3-manylinux_2_12_i686.manylinux2010_i686.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2685b6b09ba7eefe55505bf668bafff2d578fdaff5a1c8a4613d218391b8d761",
"md5": "86a5a3ecb2bd56dc443792f877b16f37",
"sha256": "0316c25b76289cf23be6b66c77d3608a4fdf537b35426280032f432f14291b9a"
},
"downloads": -1,
"filename": "nh3-0.2.17-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "86a5a3ecb2bd56dc443792f877b16f37",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 840190,
"upload_time": "2024-03-26T12:11:11",
"upload_time_iso_8601": "2024-03-26T12:11:11.238279Z",
"url": "https://files.pythonhosted.org/packages/26/85/b6b09ba7eefe55505bf668bafff2d578fdaff5a1c8a4613d218391b8d761/nh3-0.2.17-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "51aea3bbe3e237245630bc2a54a87db2be6efb42e80215f4083a9361845115d7",
"md5": "e387a66e155d0d6407365c9f57004177",
"sha256": "22c26e20acbb253a5bdd33d432a326d18508a910e4dcf9a3316179860d53345a"
},
"downloads": -1,
"filename": "nh3-0.2.17-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl",
"has_sig": false,
"md5_digest": "e387a66e155d0d6407365c9f57004177",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 774367,
"upload_time": "2024-03-26T12:11:12",
"upload_time_iso_8601": "2024-03-26T12:11:12.730178Z",
"url": "https://files.pythonhosted.org/packages/51/ae/a3bbe3e237245630bc2a54a87db2be6efb42e80215f4083a9361845115d7/nh3-0.2.17-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c5fb49273f7b161aeeffb5b4f796a53ee50852f37bd7549843e2ed76052227ef",
"md5": "e8ec70f5cf8b3fb9adf622b7f0fb5d51",
"sha256": "40015514022af31975c0b3bca4014634fa13cb5dc4dbcbc00570acc781316dcc"
},
"downloads": -1,
"filename": "nh3-0.2.17-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl",
"has_sig": false,
"md5_digest": "e8ec70f5cf8b3fb9adf622b7f0fb5d51",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 832698,
"upload_time": "2024-03-26T12:11:15",
"upload_time_iso_8601": "2024-03-26T12:11:15.960415Z",
"url": "https://files.pythonhosted.org/packages/c5/fb/49273f7b161aeeffb5b4f796a53ee50852f37bd7549843e2ed76052227ef/nh3-0.2.17-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f0f6d21910c15d6e5beccdf12d6854d996e158a74785ec1d8c8dd053507ac771",
"md5": "f12e1ed5bc0697d9abd0204eec070e06",
"sha256": "85cdbcca8ef10733bd31f931956f7fbb85145a4d11ab9e6742bbf44d88b7e351"
},
"downloads": -1,
"filename": "nh3-0.2.17-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl",
"has_sig": false,
"md5_digest": "f12e1ed5bc0697d9abd0204eec070e06",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 877795,
"upload_time": "2024-03-26T12:11:14",
"upload_time_iso_8601": "2024-03-26T12:11:14.604614Z",
"url": "https://files.pythonhosted.org/packages/f0/f6/d21910c15d6e5beccdf12d6854d996e158a74785ec1d8c8dd053507ac771/nh3-0.2.17-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "254d74b3aaaa15e0ecef58f3f3337e8b681d42e20e67483aebf48cb779ead6bb",
"md5": "e30fa06a3a88db94c94fd2d0a2579a86",
"sha256": "ba73a2f8d3a1b966e9cdba7b211779ad8a2561d2dba9674b8a19ed817923f65f"
},
"downloads": -1,
"filename": "nh3-0.2.17-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl",
"has_sig": false,
"md5_digest": "e30fa06a3a88db94c94fd2d0a2579a86",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 930397,
"upload_time": "2024-03-26T12:11:17",
"upload_time_iso_8601": "2024-03-26T12:11:17.857438Z",
"url": "https://files.pythonhosted.org/packages/25/4d/74b3aaaa15e0ecef58f3f3337e8b681d42e20e67483aebf48cb779ead6bb/nh3-0.2.17-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "da19d52d9a0247007835df949f17abd904615248dc1b94d67cb8c99100330f08",
"md5": "90e3c5b97abc6680f4189ba12579f25d",
"sha256": "c21bac1a7245cbd88c0b0e4a420221b7bfa838a2814ee5bb924e9c2f10a1120b"
},
"downloads": -1,
"filename": "nh3-0.2.17-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "90e3c5b97abc6680f4189ba12579f25d",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 777128,
"upload_time": "2024-03-26T12:11:19",
"upload_time_iso_8601": "2024-03-26T12:11:19.747472Z",
"url": "https://files.pythonhosted.org/packages/da/19/d52d9a0247007835df949f17abd904615248dc1b94d67cb8c99100330f08/nh3-0.2.17-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "40b314326a0229ae14375a22bc011e8753372d5eeed2fe415a3c120d49452ec7",
"md5": "1d91ad46e53f4ba4d382e084b215ad01",
"sha256": "d7a25fd8c86657f5d9d576268e3b3767c5cd4f42867c9383618be8517f0f022a"
},
"downloads": -1,
"filename": "nh3-0.2.17-cp37-abi3-musllinux_1_2_aarch64.whl",
"has_sig": false,
"md5_digest": "1d91ad46e53f4ba4d382e084b215ad01",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 1748194,
"upload_time": "2024-03-26T12:11:21",
"upload_time_iso_8601": "2024-03-26T12:11:21.617106Z",
"url": "https://files.pythonhosted.org/packages/40/b3/14326a0229ae14375a22bc011e8753372d5eeed2fe415a3c120d49452ec7/nh3-0.2.17-cp37-abi3-musllinux_1_2_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9b3976f24bc520eb6243589c1f2ecc089ea9ee7de0ce83e5b40342522dc0c8f0",
"md5": "1f33bff26132e47cc909ca279377a5dd",
"sha256": "c790769152308421283679a142dbdb3d1c46c79c823008ecea8e8141db1a2062"
},
"downloads": -1,
"filename": "nh3-0.2.17-cp37-abi3-musllinux_1_2_armv7l.whl",
"has_sig": false,
"md5_digest": "1f33bff26132e47cc909ca279377a5dd",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 1782439,
"upload_time": "2024-03-26T12:11:23",
"upload_time_iso_8601": "2024-03-26T12:11:23.695282Z",
"url": "https://files.pythonhosted.org/packages/9b/39/76f24bc520eb6243589c1f2ecc089ea9ee7de0ce83e5b40342522dc0c8f0/nh3-0.2.17-cp37-abi3-musllinux_1_2_armv7l.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "543f27445553120573a827a72d80acee85c7a0d2094f523469317df5c44470f8",
"md5": "50cbc3107feeb71df48a230680bbc2ac",
"sha256": "b4427ef0d2dfdec10b641ed0bdaf17957eb625b2ec0ea9329b3d28806c153d71"
},
"downloads": -1,
"filename": "nh3-0.2.17-cp37-abi3-musllinux_1_2_i686.whl",
"has_sig": false,
"md5_digest": "50cbc3107feeb71df48a230680bbc2ac",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 1701259,
"upload_time": "2024-03-26T12:11:25",
"upload_time_iso_8601": "2024-03-26T12:11:25.543148Z",
"url": "https://files.pythonhosted.org/packages/54/3f/27445553120573a827a72d80acee85c7a0d2094f523469317df5c44470f8/nh3-0.2.17-cp37-abi3-musllinux_1_2_i686.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "622dc9ed7cb1f3ddd0ec03dcfc1d0cb2f8d985db5c612f2150108d8aeb3a11c3",
"md5": "2fb8aabaac79260caae7781fbbcf3b12",
"sha256": "a3f55fabe29164ba6026b5ad5c3151c314d136fd67415a17660b4aaddacf1b10"
},
"downloads": -1,
"filename": "nh3-0.2.17-cp37-abi3-musllinux_1_2_x86_64.whl",
"has_sig": false,
"md5_digest": "2fb8aabaac79260caae7781fbbcf3b12",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 1701445,
"upload_time": "2024-03-26T12:11:27",
"upload_time_iso_8601": "2024-03-26T12:11:27.067461Z",
"url": "https://files.pythonhosted.org/packages/62/2d/c9ed7cb1f3ddd0ec03dcfc1d0cb2f8d985db5c612f2150108d8aeb3a11c3/nh3-0.2.17-cp37-abi3-musllinux_1_2_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "37a036442ad8b7bf2cc55e2a135b83782173874161362d63d198de76d7284ab3",
"md5": "9638dbcef80a58205500be94b7e24ed8",
"sha256": "1a814dd7bba1cb0aba5bcb9bebcc88fd801b63e21e2450ae6c52d3b3336bc911"
},
"downloads": -1,
"filename": "nh3-0.2.17-cp37-abi3-win32.whl",
"has_sig": false,
"md5_digest": "9638dbcef80a58205500be94b7e24ed8",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 572480,
"upload_time": "2024-03-26T12:11:29",
"upload_time_iso_8601": "2024-03-26T12:11:29.151288Z",
"url": "https://files.pythonhosted.org/packages/37/a0/36442ad8b7bf2cc55e2a135b83782173874161362d63d198de76d7284ab3/nh3-0.2.17-cp37-abi3-win32.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9d52ebab65758efae7980b15cdea290f0957ac3b25df6cbc098d9747c2b02bd3",
"md5": "f003b3367da19b958208cbd7daa83e7f",
"sha256": "1aa52a7def528297f256de0844e8dd680ee279e79583c76d6fa73a978186ddfb"
},
"downloads": -1,
"filename": "nh3-0.2.17-cp37-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "f003b3367da19b958208cbd7daa83e7f",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 571476,
"upload_time": "2024-03-26T12:11:31",
"upload_time_iso_8601": "2024-03-26T12:11:31.178403Z",
"url": "https://files.pythonhosted.org/packages/9d/52/ebab65758efae7980b15cdea290f0957ac3b25df6cbc098d9747c2b02bd3/nh3-0.2.17-cp37-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4bd2b14d619582459d2790e0c3338ec6d1611be87fdd5d1dcaca85e6c20eaed3",
"md5": "4a42eebf60281e059add7162294f3609",
"sha256": "40d0741a19c3d645e54efba71cb0d8c475b59135c1e3c580f879ad5514cbf028"
},
"downloads": -1,
"filename": "nh3-0.2.17.tar.gz",
"has_sig": false,
"md5_digest": "4a42eebf60281e059add7162294f3609",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 14981,
"upload_time": "2024-03-26T12:11:32",
"upload_time_iso_8601": "2024-03-26T12:11:32.310982Z",
"url": "https://files.pythonhosted.org/packages/4b/d2/b14d619582459d2790e0c3338ec6d1611be87fdd5d1dcaca85e6c20eaed3/nh3-0.2.17.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-26 12:11:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "messense",
"github_project": "nh3",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nh3"
}