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.8.tar.gz
(14.0 kB
view hashes)
Built Distributions
nh3-0.2.8-cp37-abi3-win_amd64.whl
(576.0 kB
view hashes)
nh3-0.2.8-cp37-abi3-win32.whl
(574.3 kB
view hashes)
Close
Hashes for nh3-0.2.8-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a104a337a036cc465f1cd698b8ffa83360fd6647ab68768fe5232fef6d314fc |
|
MD5 | 8bd18967dac79743b8c22e812bc5a73f |
|
BLAKE2b-256 | e242cf9aa10504e90ceea7b0c5bc62d8deae13384da1a1ae1f3fe2d4e1bb3e39 |
Close
Hashes for nh3-0.2.8-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25443f0d8f3285fc14ce63a50a1143940b5ae62b23ed05771d218a9b294a143a |
|
MD5 | 3486dbc0dff0f69349a5902ad27a208d |
|
BLAKE2b-256 | 8583a41881c7711e34ba1c1233b429b0e34cb7ff598a3166093458012fc80611 |
Close
Hashes for nh3-0.2.8-cp37-abi3-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a71c44bf844bf75f20925dfb2943ad1ed417eef010aa8ec378d17557f5a21b46 |
|
MD5 | ba40220f05e87e2a6bba5302b0c0c1fb |
|
BLAKE2b-256 | 334cfe4ee087a572583d804e7c1e99b57750263998bd50826eb6fbe8890a4595 |
Close
Hashes for nh3-0.2.8-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 608afb74dee1fbc2b9637d3e0908e60990971cbe279e225c3feda8b9643c3b59 |
|
MD5 | 880f2f2c54cc5adef0969150f0667109 |
|
BLAKE2b-256 | 397d29ec35a89c64ee39010f86c1c01f5878849dae529bb2f2616b8d1c74311a |
Close
Hashes for nh3-0.2.8-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a1f0f07c5fa6db10c0db7141190a3718123cd68727b50dd505b76b480b6d1ed |
|
MD5 | 35444ea32a10dff4eaf2465ed35fad20 |
|
BLAKE2b-256 | 6174af6327ee975d2b12acb22faa439014c928b23f009b1af931eb000ceea067 |
Close
Hashes for nh3-0.2.8-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00c0c285aa37c0f7cf90a0ea52a345d1c2ec74381e15e0dfc7231d332a25e2ce |
|
MD5 | 6aa21af3821333242bbe5eab4db2a8e3 |
|
BLAKE2b-256 | 18fd0949ea8ff8605046d04c71359c5bede3e86cfa7c979de82faf16f19fe2e0 |
Close
Hashes for nh3-0.2.8-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e4e48cae3460f7e465e889c71375bc31242899ff7280188e9a848dc65925fad |
|
MD5 | 97c9aa5d4cdc4bdcc6482e6655dd4cb3 |
|
BLAKE2b-256 | 46333852b1f7ea3413ea8f748335e2ba82dd2f992e202e900862dd356e5c70dc |
Close
Hashes for nh3-0.2.8-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fd21cd440c013078478442b6989205af63299c91c9b740565dc5814904b565e |
|
MD5 | ae14f257c895da1c94158e3cdd3cf794 |
|
BLAKE2b-256 | 6970342564eeb9c5a1b3f0932c20369fcbca342af59c81197a070cd9ceea0592 |
Close
Hashes for nh3-0.2.8-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 432f1c11ab7ff61b625918276c7f853a8b4d92ff5b39a8c82dad186a4ea2800b |
|
MD5 | bafd301b361d3b621991d924139bba46 |
|
BLAKE2b-256 | ccc080b9095774e736a5346d107f942062dd8f4ef8c833750fc43311f2288993 |
Close
Hashes for nh3-0.2.8-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5147509889f59c6bbff028ff1989d595435b9a45c086097754fb1ab12b7104d3 |
|
MD5 | fe2a0734668041e0e23c2fa54b2c36d3 |
|
BLAKE2b-256 | fa7df80858d526633b62ab05ee5ef3b494920d193a1d9725a8cb2e87fc1bf262 |
Close
Hashes for nh3-0.2.8-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7755635c910fde30f60fb583cea212e540329f11c89fff4ebf75d3229eacdee7 |
|
MD5 | ba05bdd75e6ae8e07f7793a93eaada01 |
|
BLAKE2b-256 | 95c2330fa9033804456ccbd7d6c28354114e8b25cba4c79bcbe4871b1697bdea |
Close
Hashes for nh3-0.2.8-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cf52f97dda315ca78a80f96b7444f5cc8241b02c2385a53e60519e36aec7e2e |
|
MD5 | 89a39cc3af5eb32ab8ed5156a9916a39 |
|
BLAKE2b-256 | 696b1e25a574f1ca10105beae21685c3b8c643d41c2c50a82d14673249187869 |