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

Uploaded Source

Built Distributions

nh3-0.2.12-cp37-abi3-win_amd64.whl (570.0 kB view details)

Uploaded CPython 3.7+ Windows x86-64

nh3-0.2.12-cp37-abi3-win32.whl (568.0 kB view details)

Uploaded CPython 3.7+ Windows x86

nh3-0.2.12-cp37-abi3-musllinux_1_2_i686.whl (1.8 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ i686

nh3-0.2.12-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.12-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.12-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.12-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.12-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.12-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.12-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.12-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.12-cp37-abi3-macosx_10_7_x86_64.whl (735.5 kB view details)

Uploaded CPython 3.7+ macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: nh3-0.2.12.tar.gz
  • Upload date:
  • Size: 14.4 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.12.tar.gz
Algorithm Hash digest
SHA256 8107c0dd534b635d76f004bfe940b3ec0d8ae4a44fcf1b77084a09d3351dbdf6
MD5 3201876448e9c2bb8a4c0714f0360fb7
BLAKE2b-256 4b7bbdcc7029284463a57f74e28218201becaab25597ec10085b9998fab0047c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nh3-0.2.12-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 570.0 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.12-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0f2fe22e2f249866bd13dbe4a130b11c210a9f706a68fc12b537ffc711164432
MD5 fc0fa1909a48808ce87567d2a7c72c52
BLAKE2b-256 090d8c56b4c5cadd2873402b6fd01dc8850a126d9e453fa3e7c6d2369d23a0cb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nh3-0.2.12-cp37-abi3-win32.whl
  • Upload date:
  • Size: 568.0 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.12-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 fce6c2096fb2f70708bba4a7713b17e8577122ce1d953f14647816706b03a648
MD5 2e92149110dc8eaef999b73bbcf222cf
BLAKE2b-256 3a73ffbadb18d0959a0554fae6e70d873d2bd4a0c211e7303d76a79ca2d329f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.12-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 2733732a3c654a9ded9a674a19b5ff6e7281adf2cd4c77f6e02bff7a4232740f
MD5 bdcafbf920476e2050238019759dc9c3
BLAKE2b-256 4cf156409ed7d72ca757c002e7aaf637409e8e06382b9448602f2586579c0928

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.12-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3ee28e4188e774749e7d5feb0fea08c88264a53ab55543bbf451b0da30f15ed5
MD5 f2b79ba1bd67ae782ac64e291953de9c
BLAKE2b-256 26c634fc6e2cc04f87fff03a9eb21f636b32171684226a6a008d27e887dc4c3d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.12-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 495c27ebeea97581a3cef9c3d012fd26ae1bb208c4aafe31b3f5af2d4b29e2d1
MD5 fb0b24c5ba3d7aa64ac39155543defd1
BLAKE2b-256 00cdadebf6c89a7eb45bb21409c30a292eb2c00c06d499f659d8bd89b39d962f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.12-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 d861cead45d7c0d18aba90cc1bf10d894aa0873609cf72d875026eca5cbf7a8d
MD5 4ed31a36f3f4638f2cb0cb53d61251e2
BLAKE2b-256 c097002a82db97ba58c29096efa2e280fdd167a55141554ab7f588ccc7526af5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.12-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 900aa20f8ce4f20c22d145a20727e6051dafec72327a79a36acce2ce51f3ca8d
MD5 5ae2dc17b7736134a192961e403beb47
BLAKE2b-256 fdc536d1b1bc423e559c83cf446414bce4a8c91376e4caa8bc22a66cd74a7b4e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.12-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 dcf95c5814b432240134f95ff043d3ecd0d2b31b8a8b68b6328d6e2a13c6ee1c
MD5 2369863bca7eeebdaf33bb57d0a02908
BLAKE2b-256 aa9b5e1e969e2357d72e1085cc015b3933777c8d7a93a6fb70fd6abf03b1321b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.12-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3f7afab764112d47b2ff09d40116f3bba0a2f3d6a1fcecc8cf8955a0469ef55b
MD5 99dde9ca97aed3370b53b03025c93f17
BLAKE2b-256 8bd797f2f3ef173ed91ce013cf532981af5be3449df260bd4d993fbeff3d2e5e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.12-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 470fd7a440129833c0cb8927fa2d8efffd56992c522ca349cbaa9deca14a11b1
MD5 5aa27366f79ef9e27b6a3b4afd2c8028
BLAKE2b-256 3e793e1d8aacbeca2fe03ceb71d4aaa4f6cf3e11adedb82274afb76e87fb1df7

See more details on using hashes here.

File details

Details for the file nh3-0.2.12-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.12-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 bf9610da79da367e01cc3d30ea9f12b40df98740e053afa4b51add93d014e513
MD5 0c00c3aa13aabbc957c4765cd0ccbbcc
BLAKE2b-256 ffec4344f624546d6f550fb810f687e819642bbff66d60a730a52d9e5d38a408

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.12-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 41d63a4ae3aad599340260e34e4c4c3c894c6ed3bd35a9c2a5f301e9115f51ba
MD5 e659a5026f58b4d26a5c2a6c361d4a75
BLAKE2b-256 7e29bfe4d2c4b957bb1883598154c853d6cc37b889e731dce4ddc801b050d662

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