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

Uploaded Source

Built Distributions

nh3-0.2.17-cp37-abi3-win_amd64.whl (571.5 kB view details)

Uploaded CPython 3.7+ Windows x86-64

nh3-0.2.17-cp37-abi3-win32.whl (572.5 kB view details)

Uploaded CPython 3.7+ Windows x86

nh3-0.2.17-cp37-abi3-musllinux_1_2_x86_64.whl (1.7 MB view details)

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

nh3-0.2.17-cp37-abi3-musllinux_1_2_i686.whl (1.7 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ i686

nh3-0.2.17-cp37-abi3-musllinux_1_2_armv7l.whl (1.8 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARMv7l

nh3-0.2.17-cp37-abi3-musllinux_1_2_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARM64

nh3-0.2.17-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (777.1 kB view details)

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

nh3-0.2.17-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (930.4 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ s390x

nh3-0.2.17-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (832.7 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ppc64le

nh3-0.2.17-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (877.8 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ppc64

nh3-0.2.17-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (774.4 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARMv7l

nh3-0.2.17-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (840.2 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARM64

nh3-0.2.17-cp37-abi3-manylinux_2_12_i686.manylinux2010_i686.whl (778.8 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.12+ i686

nh3-0.2.17-cp37-abi3-macosx_10_12_x86_64.whl (683.4 kB view details)

Uploaded CPython 3.7+ macOS 10.12+ x86-64

nh3-0.2.17-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.17.tar.gz.

File metadata

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

File hashes

Hashes for nh3-0.2.17.tar.gz
Algorithm Hash digest
SHA256 40d0741a19c3d645e54efba71cb0d8c475b59135c1e3c580f879ad5514cbf028
MD5 4a42eebf60281e059add7162294f3609
BLAKE2b-256 4bd2b14d619582459d2790e0c3338ec6d1611be87fdd5d1dcaca85e6c20eaed3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nh3-0.2.17-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 1aa52a7def528297f256de0844e8dd680ee279e79583c76d6fa73a978186ddfb
MD5 f003b3367da19b958208cbd7daa83e7f
BLAKE2b-256 9d52ebab65758efae7980b15cdea290f0957ac3b25df6cbc098d9747c2b02bd3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nh3-0.2.17-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 1a814dd7bba1cb0aba5bcb9bebcc88fd801b63e21e2450ae6c52d3b3336bc911
MD5 9638dbcef80a58205500be94b7e24ed8
BLAKE2b-256 37a036442ad8b7bf2cc55e2a135b83782173874161362d63d198de76d7284ab3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.17-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a3f55fabe29164ba6026b5ad5c3151c314d136fd67415a17660b4aaddacf1b10
MD5 2fb8aabaac79260caae7781fbbcf3b12
BLAKE2b-256 622dc9ed7cb1f3ddd0ec03dcfc1d0cb2f8d985db5c612f2150108d8aeb3a11c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.17-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 b4427ef0d2dfdec10b641ed0bdaf17957eb625b2ec0ea9329b3d28806c153d71
MD5 50cbc3107feeb71df48a230680bbc2ac
BLAKE2b-256 543f27445553120573a827a72d80acee85c7a0d2094f523469317df5c44470f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.17-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 c790769152308421283679a142dbdb3d1c46c79c823008ecea8e8141db1a2062
MD5 1f33bff26132e47cc909ca279377a5dd
BLAKE2b-256 9b3976f24bc520eb6243589c1f2ecc089ea9ee7de0ce83e5b40342522dc0c8f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.17-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 d7a25fd8c86657f5d9d576268e3b3767c5cd4f42867c9383618be8517f0f022a
MD5 1d91ad46e53f4ba4d382e084b215ad01
BLAKE2b-256 40b314326a0229ae14375a22bc011e8753372d5eeed2fe415a3c120d49452ec7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.17-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c21bac1a7245cbd88c0b0e4a420221b7bfa838a2814ee5bb924e9c2f10a1120b
MD5 90e3c5b97abc6680f4189ba12579f25d
BLAKE2b-256 da19d52d9a0247007835df949f17abd904615248dc1b94d67cb8c99100330f08

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.17-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 ba73a2f8d3a1b966e9cdba7b211779ad8a2561d2dba9674b8a19ed817923f65f
MD5 e30fa06a3a88db94c94fd2d0a2579a86
BLAKE2b-256 254d74b3aaaa15e0ecef58f3f3337e8b681d42e20e67483aebf48cb779ead6bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.17-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 40015514022af31975c0b3bca4014634fa13cb5dc4dbcbc00570acc781316dcc
MD5 e8ec70f5cf8b3fb9adf622b7f0fb5d51
BLAKE2b-256 c5fb49273f7b161aeeffb5b4f796a53ee50852f37bd7549843e2ed76052227ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.17-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 85cdbcca8ef10733bd31f931956f7fbb85145a4d11ab9e6742bbf44d88b7e351
MD5 f12e1ed5bc0697d9abd0204eec070e06
BLAKE2b-256 f0f6d21910c15d6e5beccdf12d6854d996e158a74785ec1d8c8dd053507ac771

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.17-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 22c26e20acbb253a5bdd33d432a326d18508a910e4dcf9a3316179860d53345a
MD5 e387a66e155d0d6407365c9f57004177
BLAKE2b-256 51aea3bbe3e237245630bc2a54a87db2be6efb42e80215f4083a9361845115d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.17-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0316c25b76289cf23be6b66c77d3608a4fdf537b35426280032f432f14291b9a
MD5 86a5a3ecb2bd56dc443792f877b16f37
BLAKE2b-256 2685b6b09ba7eefe55505bf668bafff2d578fdaff5a1c8a4613d218391b8d761

See more details on using hashes here.

File details

Details for the file nh3-0.2.17-cp37-abi3-manylinux_2_12_i686.manylinux2010_i686.whl.

File metadata

File hashes

Hashes for nh3-0.2.17-cp37-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 66f17d78826096291bd264f260213d2b3905e3c7fae6dfc5337d49429f1dc9f3
MD5 719bb638d7bda8771a8adefe2262b6ee
BLAKE2b-256 04c85000b81bfa6311c04d8900ae0bc27f2fc0b1c59bd34d807788f22011eda0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.17-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c551eb2a3876e8ff2ac63dff1585236ed5dfec5ffd82216a7a174f7c5082a78a
MD5 c14a5116eedb6fb1be0828ca66efb9d9
BLAKE2b-256 07a19c73f4228cb4587ac95fee1652939f420a390e6bd74af61032c871e8d757

See more details on using hashes here.

File details

Details for the file nh3-0.2.17-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.17-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 551672fd71d06cd828e282abdb810d1be24e1abb7ae2543a8fa36a71c1006fe9
MD5 29b2829723f9fe6210e46279558f5559
BLAKE2b-256 0f4e180c017c9fba59094478068d3743d764ead3132bc910d4619b7e58bccc3c

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