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

Uploaded Source

Built Distributions

nh3-0.2.14-cp37-abi3-win_amd64.whl (574.0 kB view details)

Uploaded CPython 3.7+ Windows x86-64

nh3-0.2.14-cp37-abi3-win32.whl (569.4 kB view details)

Uploaded CPython 3.7+ Windows x86

nh3-0.2.14-cp37-abi3-musllinux_1_2_x86_64.whl (1.8 MB view details)

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

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

Uploaded CPython 3.7+ musllinux: musl 1.2+ i686

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

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARMv7l

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

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARM64

nh3-0.2.14-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.14-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.0 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ s390x

nh3-0.2.14-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.14-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (1.9 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ppc64

nh3-0.2.14-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.7 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARMv7l

nh3-0.2.14-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.8 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARM64

nh3-0.2.14-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.14-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.14-cp37-abi3-macosx_10_7_x86_64.whl (737.4 kB view details)

Uploaded CPython 3.7+ macOS 10.7+ x86-64

File details

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

File metadata

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

File hashes

Hashes for nh3-0.2.14.tar.gz
Algorithm Hash digest
SHA256 a0c509894fd4dccdff557068e5074999ae3b75f4c5a2d6fb5415e782e25679c4
MD5 d4cebdad9dc8b8530e69838600faca56
BLAKE2b-256 b0bbe967b7bc659cd1fd87f845d02194a08ea8da88d7d9dcc28164ee513f76f3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nh3-0.2.14-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 88c753efbcdfc2644a5012938c6b9753f1c64a5723a67f0301ca43e7b85dcf0e
MD5 4c3e587702d95c8db399ff18dfc3a149
BLAKE2b-256 534cc34a0a48e81f3328e3300038d52195a2387d82570b0f17df53033c40bc23

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nh3-0.2.14-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 116c9515937f94f0057ef50ebcbcc10600860065953ba56f14473ff706371873
MD5 f705b6fda15c10de8c4b5980b1688c6c
BLAKE2b-256 5325789f7cd178600736e73064eae6230fa959e890588fcb4cda2c9948c0285b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.14-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 aed56a86daa43966dd790ba86d4b810b219f75b4bb737461b6886ce2bde38fd6
MD5 1879f82d82e1fc44970d7b7b501387f2
BLAKE2b-256 db8d8dd2bb443dc2e201a77dccb4fdc3d8614c75ecab78ef639267398574aacf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.14-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 5529a3bf99402c34056576d80ae5547123f1078da76aa99e8ed79e44fa67282d
MD5 7cdd70141fe1e26f6a8c66c43d7ba6bb
BLAKE2b-256 84c4fb9f8228017f1dfd1f34087cad0fd625205c6a40655a5097661584dc17e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.14-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 203cac86e313cf6486704d0ec620a992c8bc164c86d3a4fd3d761dd552d839b5
MD5 1699f1962feef7a3ffc9408f688f7649
BLAKE2b-256 293fa86a88160d34553170de9d668dce887a25da5460ead10840784a26642eb4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.14-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 ac8056e937f264995a82bf0053ca898a1cb1c9efc7cd68fa07fe0060734df7e4
MD5 a60558b7cf4b86249e12eca6e9edeee9
BLAKE2b-256 33c2ec64f6ca24ae697586aa773b6030b37d9f69dcb5d2976a454b5b903a4595

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.14-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2b0be5c792bd43d0abef8ca39dd8acb3c0611052ce466d0401d51ea0d9aa7525
MD5 bb93d03c9e12e6d754ab9906088fedd2
BLAKE2b-256 b7cd7f64121ec731255265867e0d7d782962f2bd1f15fce83f523c8f6b69463b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.14-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 377aaf6a9e7c63962f367158d808c6a1344e2b4f83d071c43fbd631b75c4f0b2
MD5 aef8601d92054b8a567d319bab1f316f
BLAKE2b-256 fb94209610642b7eccbb712109689c17a5b9335c44342895afd80d54f08b15ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.14-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 18415df36db9b001f71a42a3a5395db79cf23d556996090d293764436e98e8ad
MD5 853ac3bbc0c1d9162ba989a85eee808a
BLAKE2b-256 c629bd063844e2c16b42055dc867a9b9657a202d6c06662f746c24f286d0057d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.14-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 e8986f1dd3221d1e741fda0a12eaa4a273f1d80a35e31a1ffe579e7c621d069e
MD5 146bbc007c7b9c51891039ca9ac89d93
BLAKE2b-256 b7df9c0af8a1ded962b5ade6bc505717fe4fbfe7ee9e7caa68562b514e25f938

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.14-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 525846c56c2bcd376f5eaee76063ebf33cf1e620c1498b2a40107f60cfc6054e
MD5 23460d257948a22b278331b1121542db
BLAKE2b-256 1839f0f92819fc15f66fa0b1a3080b7cc95e106e8ba4c09287ab99237dc9eda4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.14-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7771d43222b639a4cd9e341f870cee336b9d886de1ad9bec8dddab22fe1de450
MD5 8928c267fe4b03b119f018cd85c7ea25
BLAKE2b-256 1caa3ad9be86c97d6f90eab83d949ab97c8840a8a7f5da5ffd566867309bce06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.14-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 93a943cfd3e33bd03f77b97baa11990148687877b74193bf777956b67054dcc6
MD5 626ad49d2c88ad41cf87cd17acf42c2d
BLAKE2b-256 2255ea7ea4ef61f278809a6ef0a48aff6764de337286a0e58efdbaed117feb37

See more details on using hashes here.

File details

Details for the file nh3-0.2.14-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.14-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 f99212a81c62b5f22f9e7c3e347aa00491114a5647e1f13bbebd79c3e5f08d75
MD5 390ed3cca235b2684031a42d0867d1bf
BLAKE2b-256 c1e56f8b8ffb51b0e676b9e058c881bd7db68e4e29a82797a06ff598f9c6a251

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.14-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 9be2f68fb9a40d8440cbf34cbf40758aa7f6093160bfc7fb018cce8e424f0c3a
MD5 6e7763797f125f06285817d420b14fb8
BLAKE2b-256 7bc8f5a850c1482c527b4b514ee15307b46c5037e52c1c73c373d85f79bb7a2f

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