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

Uploaded Source

Built Distributions

nh3-0.2.18-cp37-abi3-win_amd64.whl (579.0 kB view details)

Uploaded CPython 3.7+ Windows x86-64

nh3-0.2.18-cp37-abi3-win32.whl (573.8 kB view details)

Uploaded CPython 3.7+ Windows x86

nh3-0.2.18-cp37-abi3-musllinux_1_2_x86_64.whl (941.5 kB view details)

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

nh3-0.2.18-cp37-abi3-musllinux_1_2_i686.whl (942.5 kB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ i686

nh3-0.2.18-cp37-abi3-musllinux_1_2_armv7l.whl (1.0 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARMv7l

nh3-0.2.18-cp37-abi3-musllinux_1_2_aarch64.whl (1.0 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARM64

nh3-0.2.18-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (769.2 kB view details)

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

nh3-0.2.18-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (924.1 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ s390x

nh3-0.2.18-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (841.1 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ppc64le

nh3-0.2.18-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (879.8 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ppc64

nh3-0.2.18-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (782.5 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARMv7l

nh3-0.2.18-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (844.1 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARM64

nh3-0.2.18-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl (791.0 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.5+ i686

nh3-0.2.18-cp37-abi3-macosx_10_12_x86_64.whl (694.6 kB view details)

Uploaded CPython 3.7+ macOS 10.12+ x86-64

nh3-0.2.18-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.18.tar.gz.

File metadata

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

File hashes

Hashes for nh3-0.2.18.tar.gz
Algorithm Hash digest
SHA256 94a166927e53972a9698af9542ace4e38b9de50c34352b962f4d9a7d4c927af4
MD5 cda29ff819430f0a05c5fe5a1ad15f04
BLAKE2b-256 627310df50b42ddb547a907deeb2f3c9823022580a7a47281e8eae8e003a9639

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nh3-0.2.18-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8ce0f819d2f1933953fca255db2471ad58184a60508f03e6285e5114b6254844
MD5 97ff3c621b47a9403e494acbda216992
BLAKE2b-256 268d53c5b19c4999bdc6ba95f246f4ef35ca83d7d7423e5e38be43ad66544e5d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nh3-0.2.18-cp37-abi3-win32.whl
  • Upload date:
  • Size: 573.8 kB
  • Tags: CPython 3.7+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for nh3-0.2.18-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 a7f1b5b2c15866f2db413a3649a8fe4fd7b428ae58be2c0f6bca5eefd53ca2be
MD5 e62eca0ffab5e1a79a18e82cb1e9bc65
BLAKE2b-256 784854a788fc9428e481b2f58e0cd8564f6c74ffb6e9ef73d39e8acbeae8c629

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.18-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 36c95d4b70530b320b365659bb5034341316e6a9b30f0b25fa9c9eff4c27a204
MD5 3f5bf7787842a72d44df056e59183854
BLAKE2b-256 eb6173a007c74c37895fdf66e0edcd881f5eaa17a348ff02f4bb4bc906d61085

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.18-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 c8b3a1cebcba9b3669ed1a84cc65bf005728d2f0bc1ed2a6594a992e817f3a50
MD5 58ff8b9859426e242ff7feaa58659935
BLAKE2b-256 631d842fed85cf66c973be0aed8770093d6a04741f65e2c388ddd4c07fd3296e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.18-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 3a157ab149e591bb638a55c8c6bcb8cdb559c8b12c13a8affaba6cedfe51713a
MD5 848853dffa722e97685cbca8e8e5055c
BLAKE2b-256 de81c291231463d21da5f8bba82c8167a6d6893cc5419b0639801ee5d3aeb8a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.18-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 f0eca9ca8628dbb4e916ae2491d72957fdd35f7a5d326b7032a345f111ac07fe
MD5 e07af13784b0d70cf88b36976c6e7f99
BLAKE2b-256 a3da0c4e282bc3cff4a0adf37005fa1fb42257673fbc1bbf7d1ff639ec3d255a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.18-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 de3ceed6e661954871d6cd78b410213bdcb136f79aafe22aa7182e028b8c7307
MD5 ebefb18c09e91b3a43423c7f62d80ff4
BLAKE2b-256 1b636ab90d0e5225ab9780f6c9fb52254fa36b52bb7c188df9201d05b647e5e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.18-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 19aaba96e0f795bd0a6c56291495ff59364f4300d4a39b29a0abc9cb3774a84b
MD5 4c47f5a5c7d7d98f3a2d9d2fc40dca46
BLAKE2b-256 c2a83bb02d0c60a03ad3a112b76c46971e9480efa98a8946677b5a59f60130ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.18-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 34c03fa78e328c691f982b7c03d4423bdfd7da69cd707fe572f544cf74ac23ad
MD5 0cf11c40b58072ad14598e969b0708db
BLAKE2b-256 aba7375afcc710dbe2d64cfbd69e31f82f3e423d43737258af01f6a56d844085

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.18-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 5f36b271dae35c465ef5e9090e1fdaba4a60a56f0bb0ba03e0932a66f28b9189
MD5 ad23f6f8878ee30e3f9ecf8b3ce2c8ae
BLAKE2b-256 72f25c894d5265ab80a97c68ca36f25c8f6f0308abac649aaf152b74e7e854a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.18-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 0411beb0589eacb6734f28d5497ca2ed379eafab8ad8c84b31bb5c34072b7164
MD5 9bdef8a07a7d9ef0fe1368a072ad8a03
BLAKE2b-256 052b85977d9e11713b5747595ee61f381bc820749daf83f07b90b6c9964cf932

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.18-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 42c64511469005058cd17cc1537578eac40ae9f7200bedcfd1fc1a05f4f8c200
MD5 1151483fc67a31e81a7efb87a84bbd90
BLAKE2b-256 45b9833f385403abaf0023c6547389ec7a7acf141ddd9d1f21573723a6eab39a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.18-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 6955369e4d9f48f41e3f238a9e60f9410645db7e07435e62c6a9ea6135a4907f
MD5 c52734e8f63f4792ef907887805bd8ea
BLAKE2b-256 a41759391c28580e2c32272761629893e761442fc7666da0b1cdb479f3b67b88

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.18-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7b7c2a3c9eb1a827d42539aa64091640bd275b81e097cd1d8d82ef91ffa2e811
MD5 9440409532962ed10fdcbe6d8c83471b
BLAKE2b-256 2cb642fc3c69cabf86b6b81e4c051a9b6e249c5ba9f8155590222c2622961f58

See more details on using hashes here.

File details

Details for the file nh3-0.2.18-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.18-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 14c5a72e9fe82aea5fe3072116ad4661af5cf8e8ff8fc5ad3450f123e4925e86
MD5 81c8ef49a13c7b243ef609e280ac2650
BLAKE2b-256 b3891daff5d9ba5a95a157c092c7c5f39b8dd2b1ddb4559966f808d31cfb67e0

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