Skip to main content

Ammonia HTML sanitizer Python binding

Project description

nh3

CI PyPI Documentation Status

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


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

Uploaded Source

Built Distributions

nh3-0.2.13-cp37-abi3-win_amd64.whl (570.5 kB view details)

Uploaded CPython 3.7+ Windows x86-64

nh3-0.2.13-cp37-abi3-win32.whl (568.3 kB view details)

Uploaded CPython 3.7+ Windows x86

nh3-0.2.13-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.13-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.13-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.13-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.13-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.13-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.13-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.13-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (1.5 MB view details)

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

nh3-0.2.13-cp37-abi3-macosx_10_7_x86_64.whl (736.8 kB view details)

Uploaded CPython 3.7+ macOS 10.7+ x86-64

File details

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

File metadata

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

File hashes

Hashes for nh3-0.2.13.tar.gz
Algorithm Hash digest
SHA256 ec6a841795b129bcee1eda73feeb8e7f5f83a354979d3719fb77f3da60f6fa96
MD5 331cd3fc821a86ab7bc3cb2e20223f1b
BLAKE2b-256 70714938706ce0daf4ff981ae1c0b5f03fec4b0685f3800685ba2491b22a98c2

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nh3-0.2.13-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 3eb8e3b4dbf138e8dcdffc8f40926661fe2e08317b8b79277c66a78f58f37454
MD5 b0d6732696c33352df31108cfee6603e
BLAKE2b-256 89efa7d092d0cdbfe710a44e950fb34b00301ee8d7e66aa6099a5de79aeece03

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nh3-0.2.13-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 08142a23db63c3f43f33feda14e9b48782a13ced3c6b7e84cf7242b298f9214d
MD5 06f8222c17200dc02152b7494d5ff07d
BLAKE2b-256 db8edf3cfe0a66463d8fd55c3091514fe8186f3fc59918a9a4bb469809a7b5ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.13-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0f041f8e9d2d0a0898cc216fe2519ae1bdcb5724a1d36f02c0c3a49b5efac7a4
MD5 362e0d8bfb63f7c6ee76f35fc35e9ea9
BLAKE2b-256 eda4d5a3d267496d2766f7cb3dcb4280bbd40c8921dd8eea4455a66881a6446b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.13-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 94fae4130ab69f42e65d49bad695e147a48ae01834cc84498c7dc88bc55341e7
MD5 6557d2e298749e71fa01881ea5c6cee3
BLAKE2b-256 fe58de44bb70ef9e467afb44047e62a3af6e11896df221e8c0832730eae0d4d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.13-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 5c9d7d8cab927e12988cfcedea1415c013edb476b6d036dd97c5c58b4704c19b
MD5 b27f478f330db82d110c89a4affc6299
BLAKE2b-256 89bde374ee1db59900d43f3ac73be53b967c31190e96dc3188b73dbb7628302f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.13-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 43c76836bce8cfc5a59ab6f8b51c421e89d19408f31cd216bd76ba362f341301
MD5 39b9ab827c03c345eaab4a085476f542
BLAKE2b-256 6a3629324d9f4e9411ad37d1476bc9f659b5e23e03e1382346a8c11782516f62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.13-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 09a67c3405495af52bf62a47e7881c3e7378f6d664dc89cd0da5643bfda65483
MD5 8d44534f0eae59ff05604b992535cafc
BLAKE2b-256 96d64862d666f68e67ac8cea5d29841a4058eaad4791b3bad67a4c30afbf3b13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.13-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 63abfac340110f4b5281a24aba3083ca8010b22d8b451c2b730655398a4d9e6a
MD5 b7d890ebd618763f95bcc4f85e627f6c
BLAKE2b-256 ef18e16daf8e2fcc9ba19334fb14308fcc58a21a6db2fdeb07b0b6d4763a5442

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.13-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 27d6f6b2265579520fc860ca81a4f1be118ce512c9172bf78fb56d799c3ac196
MD5 d204055a15833d9dffb27d29adb82c5f
BLAKE2b-256 ed3abe27c4cd28d4683278ae15a7a899082660f94e1b82722f3a68585e3a3164

See more details on using hashes here.

File details

Details for the file nh3-0.2.13-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for nh3-0.2.13-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 4f508411b380465943ba197cef76f5b6ce0995b7251315fb44bc63a6921faf14
MD5 36f896161420e379dceaecf283ed2b28
BLAKE2b-256 d919dedc00f01976524905720918db98d6807d4c6413c2a7443155c2bb9ba493

See more details on using hashes here.

File details

Details for the file nh3-0.2.13-cp37-abi3-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for nh3-0.2.13-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 9d86d0476177ebdbbd9ae879449173333452fd9810e9bdd55540b21d650cda5a
MD5 ee87db407a06feb93122de43188cfb7d
BLAKE2b-256 a8780562c89e52b0c5d6f320a557003e0128c0ac88bdd0ecefe57ed6a5afd932

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