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.10.tar.gz
(14.1 kB
view hashes)
Built Distributions
nh3-0.2.10-cp37-abi3-win_amd64.whl
(565.3 kB
view hashes)
nh3-0.2.10-cp37-abi3-win32.whl
(564.7 kB
view hashes)
Close
Hashes for nh3-0.2.10-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b076483e94ef4837358d4c449a621a2ac26360921829f8ff8c6322cdd11c6379 |
|
MD5 | 3196e80ff7ccbbf965adedeb67c9e018 |
|
BLAKE2b-256 | 26eecfda1f9d4a50a3a7295dd60ddcbc7f7c1b7c8d31ec7f57aeecff0db22a0c |
Close
Hashes for nh3-0.2.10-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc71967a59c8c096ba1741959db9e8ebc7ea9913f9694acd0cd914c31591ef35 |
|
MD5 | c8cc923fdd2aa177314ba9efcdb04f6d |
|
BLAKE2b-256 | 932da1add4860c48447dfc3d601744ab0a3840aaddb9879dcb2f2adc7c712980 |
Close
Hashes for nh3-0.2.10-cp37-abi3-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a0eaa4bae15e40fc7a82dcdba29258732c67cad151fc309909e98f9e8b1c3aa |
|
MD5 | ac88b92627f1b2bef47c1b807a6867e6 |
|
BLAKE2b-256 | 9ad66ba57e2f5e5c597597028f8319f6e8cbf0f2ec4e7a98127fc2878e2bb860 |
Close
Hashes for nh3-0.2.10-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9999c8166cc40b80af3e1520e3ba1dfca86b30e4605004453612fc15cfc3dc54 |
|
MD5 | 8cc93cc978dfbcb43d643aee727083d6 |
|
BLAKE2b-256 | 8ff3030ea4f8fba4f3344cfefa1990e130b49ec2ea77af5895eeb45b95612be2 |
Close
Hashes for nh3-0.2.10-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1bfa864132b9d276a003c2ad891299bb05bf9ba97a159ac81844a0510b2f956 |
|
MD5 | 8eb14cea8fa6ad3073069e9cc5e80309 |
|
BLAKE2b-256 | 37441e3dd232e3453c2aec9a8d6ced1c144928151ae428d3fc033a5d5325e074 |
Close
Hashes for nh3-0.2.10-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e5dcd9eeec574664e563bfa15fa458d755eceb974fa050340ec34975c224716 |
|
MD5 | fab5464e8e1bbe5620bb5360dea3a463 |
|
BLAKE2b-256 | eaf2f233639be86ecbe83d499e2758d4c08d766dcd7506e316729836a1b73e1b |
Close
Hashes for nh3-0.2.10-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6344d4e9b3ab1bbdda821fca42b2027f407a879b7d63dd4cc1ed8876150411e4 |
|
MD5 | 48b68185a279fb92c8efaf189b279cce |
|
BLAKE2b-256 | 82d8e69c3c5ebf0a9d7987a6fd55be01035e18a34258720c75c98b344007051b |
Close
Hashes for nh3-0.2.10-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4bc2e52806bcad5049a0b3c6b722518174480b6a1481080cca9dbe2eab34817 |
|
MD5 | 18f7ac1549b31f688d41e1bf159768ad |
|
BLAKE2b-256 | 3d4c9559f3d43d91f27b9b4729e73339ac1f1f3c0f364ab1eb937cd3c2b99f7f |
Close
Hashes for nh3-0.2.10-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc19c581a1001d7a12ce040f7d7f3f6955b9202aea03bb9e874b862ab0c89815 |
|
MD5 | 2a41ec09724d1552eb47208fe6bf7b87 |
|
BLAKE2b-256 | 9a4ad0d6df3670dd75a8139d246ec18f3b1d5321600b27ef1f9949df46234460 |
Close
Hashes for nh3-0.2.10-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d3986a0ba2940704e05061d499cf44668640beda0ea2b5f72fc853530c282a4 |
|
MD5 | e515b2b03d360235855b23bdc8b22bc8 |
|
BLAKE2b-256 | 9bbe40c6b271f9abf305cab22787a7d5af75d992f9cec6bb5b266562a21c061c |
Close
Hashes for nh3-0.2.10-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82843a01b56b3fa12089c0535de8b2c1655cd64fbe5972581f123dc49063c73d |
|
MD5 | 1a3429f3dc62e32aaa8e3699a45b9010 |
|
BLAKE2b-256 | 5f516e1db0adb1c227e6ae1e4abe3963153dd7a5af11a1bcd80cdde4860a2b26 |
Close
Hashes for nh3-0.2.10-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce3c1b3fb5d29544167d6234f03a9278128922960cd5f5608c530e4deb90b2dd |
|
MD5 | 9b7490d9486454ce162b4eff63f1d63e |
|
BLAKE2b-256 | 8c2cc7b365258ec8b052a2bf94ec4f91f067a7dd7a7b334d6694ce278bfd3625 |
Close
Hashes for nh3-0.2.10-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4171c4b08cea9f7c22c98d6b83b0f8a321bae57352e2795d31e7f5526788027 |
|
MD5 | 6a6572c3659aa33f87ecee2c71bc871f |
|
BLAKE2b-256 | a8dc61e6a2b68659cb619bbef23bdcd9b85cc64c6244c77da6ff767489404eab |
Close
Hashes for nh3-0.2.10-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41649beaddc2c4f122fe06ae33ad20e29141d2ee782e0e339a83870347973200 |
|
MD5 | b3eabc0b4f363ebae057754124d14f13 |
|
BLAKE2b-256 | a85e5b1cc32290b42df5c1b0f2eea5692157c3238b4e6459b9cec93f25a47c6b |