Ammonia HTML sanitizer Python binding
Project description
nh3
ammonia Python binding.
Installation
pip install nh3
Usage
import nh3
print(nh3.clean("<b><img src=\"\">I'm not trying to XSS you</b>"))
Performance
Running on MacBook Air (M2, 2022)
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 file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nh3-0.2.13.tar.gz
(14.5 kB
view hashes)
Built Distributions
nh3-0.2.13-cp37-abi3-win_amd64.whl
(570.5 kB
view hashes)
nh3-0.2.13-cp37-abi3-win32.whl
(568.3 kB
view hashes)
Close
Hashes for nh3-0.2.13-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3eb8e3b4dbf138e8dcdffc8f40926661fe2e08317b8b79277c66a78f58f37454 |
|
MD5 | b0d6732696c33352df31108cfee6603e |
|
BLAKE2b-256 | 89efa7d092d0cdbfe710a44e950fb34b00301ee8d7e66aa6099a5de79aeece03 |
Close
Hashes for nh3-0.2.13-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f041f8e9d2d0a0898cc216fe2519ae1bdcb5724a1d36f02c0c3a49b5efac7a4 |
|
MD5 | 362e0d8bfb63f7c6ee76f35fc35e9ea9 |
|
BLAKE2b-256 | eda4d5a3d267496d2766f7cb3dcb4280bbd40c8921dd8eea4455a66881a6446b |
Close
Hashes for nh3-0.2.13-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94fae4130ab69f42e65d49bad695e147a48ae01834cc84498c7dc88bc55341e7 |
|
MD5 | 6557d2e298749e71fa01881ea5c6cee3 |
|
BLAKE2b-256 | fe58de44bb70ef9e467afb44047e62a3af6e11896df221e8c0832730eae0d4d0 |
Close
Hashes for nh3-0.2.13-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c9d7d8cab927e12988cfcedea1415c013edb476b6d036dd97c5c58b4704c19b |
|
MD5 | b27f478f330db82d110c89a4affc6299 |
|
BLAKE2b-256 | 89bde374ee1db59900d43f3ac73be53b967c31190e96dc3188b73dbb7628302f |
Close
Hashes for nh3-0.2.13-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43c76836bce8cfc5a59ab6f8b51c421e89d19408f31cd216bd76ba362f341301 |
|
MD5 | 39b9ab827c03c345eaab4a085476f542 |
|
BLAKE2b-256 | 6a3629324d9f4e9411ad37d1476bc9f659b5e23e03e1382346a8c11782516f62 |
Close
Hashes for nh3-0.2.13-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09a67c3405495af52bf62a47e7881c3e7378f6d664dc89cd0da5643bfda65483 |
|
MD5 | 8d44534f0eae59ff05604b992535cafc |
|
BLAKE2b-256 | 96d64862d666f68e67ac8cea5d29841a4058eaad4791b3bad67a4c30afbf3b13 |
Close
Hashes for nh3-0.2.13-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63abfac340110f4b5281a24aba3083ca8010b22d8b451c2b730655398a4d9e6a |
|
MD5 | b7d890ebd618763f95bcc4f85e627f6c |
|
BLAKE2b-256 | ef18e16daf8e2fcc9ba19334fb14308fcc58a21a6db2fdeb07b0b6d4763a5442 |
Close
Hashes for nh3-0.2.13-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27d6f6b2265579520fc860ca81a4f1be118ce512c9172bf78fb56d799c3ac196 |
|
MD5 | d204055a15833d9dffb27d29adb82c5f |
|
BLAKE2b-256 | ed3abe27c4cd28d4683278ae15a7a899082660f94e1b82722f3a68585e3a3164 |
Close
Hashes for nh3-0.2.13-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f508411b380465943ba197cef76f5b6ce0995b7251315fb44bc63a6921faf14 |
|
MD5 | 36f896161420e379dceaecf283ed2b28 |
|
BLAKE2b-256 | d919dedc00f01976524905720918db98d6807d4c6413c2a7443155c2bb9ba493 |
Close
Hashes for nh3-0.2.13-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d86d0476177ebdbbd9ae879449173333452fd9810e9bdd55540b21d650cda5a |
|
MD5 | ee87db407a06feb93122de43188cfb7d |
|
BLAKE2b-256 | a8780562c89e52b0c5d6f320a557003e0128c0ac88bdd0ecefe57ed6a5afd932 |