Skip to main content

Python bindings to the ammonia HTML sanitization library.

Project description

nh3

CI PyPI Documentation Status

Python bindings to the ammonia HTML sanitization library.

Installation

pip install nh3

Usage

See the documentation.

Performance

A quick benchmark showing that nh3 is about 20 times faster than the deprecated bleach package. Measured on a 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


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.15.tar.gz (14.7 kB view details)

Uploaded Source

Built Distributions

nh3-0.2.15-cp37-abi3-win_amd64.whl (563.7 kB view details)

Uploaded CPython 3.7+ Windows x86-64

nh3-0.2.15-cp37-abi3-win32.whl (564.0 kB view details)

Uploaded CPython 3.7+ Windows x86

nh3-0.2.15-cp37-abi3-musllinux_1_2_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ x86-64

nh3-0.2.15-cp37-abi3-musllinux_1_2_i686.whl (1.9 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ i686

nh3-0.2.15-cp37-abi3-musllinux_1_2_armv7l.whl (1.9 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARMv7l

nh3-0.2.15-cp37-abi3-musllinux_1_2_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARM64

nh3-0.2.15-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ x86-64

nh3-0.2.15-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.9 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ s390x

nh3-0.2.15-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.8 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ppc64le

nh3-0.2.15-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (1.8 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ppc64

nh3-0.2.15-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.6 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARMv7l

nh3-0.2.15-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARM64

nh3-0.2.15-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl (1.7 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.5+ i686

nh3-0.2.15-cp37-abi3-macosx_10_12_x86_64.whl (694.8 kB view details)

Uploaded CPython 3.7+ macOS 10.12+ x86-64

nh3-0.2.15-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.4 MB view details)

Uploaded CPython 3.7+ macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64

File details

Details for the file nh3-0.2.15.tar.gz.

File metadata

  • Download URL: nh3-0.2.15.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for nh3-0.2.15.tar.gz
Algorithm Hash digest
SHA256 d1e30ff2d8d58fb2a14961f7aac1bbb1c51f9bdd7da727be35c63826060b0bf3
MD5 91b175342a993f067eb03e7139bf9b47
BLAKE2b-256 0803506eb477d723da0db7c46d6259ee06bc68243ef40f5626eb66ab72ae4d69

See more details on using hashes here.

File details

Details for the file nh3-0.2.15-cp37-abi3-win_amd64.whl.

File metadata

  • Download URL: nh3-0.2.15-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 563.7 kB
  • Tags: CPython 3.7+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for nh3-0.2.15-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 bc2d086fb540d0fa52ce35afaded4ea526b8fc4d3339f783db55c95de40ef02e
MD5 a0e51e649709c780d6f64c8df0664445
BLAKE2b-256 6bd293c8c82464d9562eae68b8e442c00d5a0d1c6a2d74478642d8bd22b45aee

See more details on using hashes here.

File details

Details for the file nh3-0.2.15-cp37-abi3-win32.whl.

File metadata

  • Download URL: nh3-0.2.15-cp37-abi3-win32.whl
  • Upload date:
  • Size: 564.0 kB
  • Tags: CPython 3.7+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for nh3-0.2.15-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 427fecbb1031db085eaac9931362adf4a796428ef0163070c484b5a768e71601
MD5 b67ddb1bf0232ab94bd160d500972b25
BLAKE2b-256 55e6b70501e8536d63a261962195ceea715a6af1bdd742866bd6f06b262f5fbd

See more details on using hashes here.

File details

Details for the file nh3-0.2.15-cp37-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for nh3-0.2.15-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a5167a6403d19c515217b6bcaaa9be420974a6ac30e0da9e84d4fc67a5d474c5
MD5 05943f8aeeb704da5038be14c98f8a62
BLAKE2b-256 f9680ba3dba816712566961c40dfcc8194424483d1a2039f8c2321f66cd013ec

See more details on using hashes here.

File details

Details for the file nh3-0.2.15-cp37-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for nh3-0.2.15-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 b1e97221cedaf15a54f5243f2c5894bb12ca951ae4ddfd02a9d4ea9df9e1a29d
MD5 9efad8b94ed353d8af640e5746e8e6f4
BLAKE2b-256 68b3394a2512c92610b817307ce9e212156bdc97d0c743df391e2db99545b855

See more details on using hashes here.

File details

Details for the file nh3-0.2.15-cp37-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for nh3-0.2.15-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 f3b53ba93bb7725acab1e030bc2ecd012a817040fd7851b332f86e2f9bb98dc6
MD5 3db8f7e17572188c46faec611c55ea40
BLAKE2b-256 f30c209fe880a9eda679fd2b97dcb702bc5c994c4fdee19bc3f3ef41f0d2b4d3

See more details on using hashes here.

File details

Details for the file nh3-0.2.15-cp37-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for nh3-0.2.15-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 0d02d0ff79dfd8208ed25a39c12cbda092388fff7f1662466e27d97ad011b770
MD5 8b180a631eccbfd536662b548416bebb
BLAKE2b-256 3db8ebeb739ef1b03584a7ec462013cdb86d32c371595fc29a5f40cfab338d98

See more details on using hashes here.

File details

Details for the file nh3-0.2.15-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nh3-0.2.15-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 60684857cfa8fdbb74daa867e5cad3f0c9789415aba660614fe16cd66cbb9ec7
MD5 f57b7dc76ff5a0dab195630798d1b9b5
BLAKE2b-256 7767e5d91360d1414016326ed0c3e9cf74e38fa60245e0194ba9fe2644648a51

See more details on using hashes here.

File details

Details for the file nh3-0.2.15-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for nh3-0.2.15-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 3277481293b868b2715907310c7be0f1b9d10491d5adf9fce11756a97e97eddf
MD5 8bc9e3c3039ef8f4afce644ce0860a30
BLAKE2b-256 6825e750f42ffdf718f1bb3e60a567c1fe9f45b20e10374afb5edfe781b17b71

See more details on using hashes here.

File details

Details for the file nh3-0.2.15-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for nh3-0.2.15-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 86e447a63ca0b16318deb62498db4f76fc60699ce0a1231262880b38b6cff911
MD5 ecfaf859385119978ea531203ad2f212
BLAKE2b-256 e41565dccfb18a1164d17b0dd849b6914b2f8a8e363b1d2d6593d36e4167215c

See more details on using hashes here.

File details

Details for the file nh3-0.2.15-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl.

File metadata

File hashes

Hashes for nh3-0.2.15-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 8d595df02413aa38586c24811237e95937ef18304e108b7e92c890a06793e3bf
MD5 9df70407918186fdde464ba5673575f4
BLAKE2b-256 f3f3196fa8da09be72ec8473bdaa5218be7a5a654922e2afff1f6fecccfa8ade

See more details on using hashes here.

File details

Details for the file nh3-0.2.15-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for nh3-0.2.15-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 5f0d77272ce6d34db6c87b4f894f037d55183d9518f948bba236fe81e2bb4e28
MD5 8a6c48aad662c77d9e8e22626e9e80e5
BLAKE2b-256 97efcd5efc5ddef683ffd5aab015a60bf873677fc61ae049e73c58c6774cf6d3

See more details on using hashes here.

File details

Details for the file nh3-0.2.15-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nh3-0.2.15-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ac19c0d68cd42ecd7ead91a3a032fdfff23d29302dbb1311e641a130dfefba97
MD5 39980c424b65cb8758afcb4e02159720
BLAKE2b-256 2c2c033432bde3d44577774ffac881e3935ce7b30787e1a15c5238dbb682d737

See more details on using hashes here.

File details

Details for the file nh3-0.2.15-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for nh3-0.2.15-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 3b803a5875e7234907f7d64777dfde2b93db992376f3d6d7af7f3bc347deb305
MD5 b43c15d3a57a92a3a80a183bc73e49c2
BLAKE2b-256 13a8195de328bcb1dbc8050702addc26149aea7d8d791806041a06077d683ac4

See more details on using hashes here.

File details

Details for the file nh3-0.2.15-cp37-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for nh3-0.2.15-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6f42f99f0cf6312e470b6c09e04da31f9abaadcd3eb591d7d1a88ea931dca7f3
MD5 a69706c702621e002b1c0d957230e651
BLAKE2b-256 57655b29934fc0f292526574768c9e9c36fa2b6e760a66ff22bb733d342c37ad

See more details on using hashes here.

File details

Details for the file nh3-0.2.15-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for nh3-0.2.15-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 9c0d415f6b7f2338f93035bba5c0d8c1b464e538bfbb1d598acd47d7969284f0
MD5 e3cb7f5d12284f07d3d6530f076a58d0
BLAKE2b-256 9eea6e5b37be087f62ab8341dac0287536a98d2062e57bb80cfd684af94b7a56

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page