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

Uploaded Source

Built Distributions

nh3-0.2.11-cp37-abi3-win_amd64.whl (566.5 kB view details)

Uploaded CPython 3.7+ Windows x86-64

nh3-0.2.11-cp37-abi3-win32.whl (566.6 kB view details)

Uploaded CPython 3.7+ Windows x86

nh3-0.2.11-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.11-cp37-abi3-musllinux_1_2_i686.whl (1.8 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ i686

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

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARMv7l

nh3-0.2.11-cp37-abi3-musllinux_1_2_aarch64.whl (1.8 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARM64

nh3-0.2.11-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

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

nh3-0.2.11-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.11-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.11-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.11-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.11-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.11-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.11-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (1.4 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.11-cp37-abi3-macosx_10_7_x86_64.whl (728.7 kB view details)

Uploaded CPython 3.7+ macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: nh3-0.2.11.tar.gz
  • Upload date:
  • Size: 14.3 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.11.tar.gz
Algorithm Hash digest
SHA256 3ed2624ca0a1cec3128e8f915e9954dbf6d0e71e76b29813c699fb2d46d01b8f
MD5 6b0686f69f8d614c8d1cbfa0209107e1
BLAKE2b-256 88a8adb5d8a4fd10d5d4287b1c68c4f88332a570b8627868f951dbd5b4fdc43a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nh3-0.2.11-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 566.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.11-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0109585b316979073ab67d8ee951c976758216a75b9b43f3a6929db54c2cb1c3
MD5 4d2955a11ff4cd0288384e1a4de58ec9
BLAKE2b-256 6ad546f71fb777a23e17ad2a7d73f49dd8693dec1d52d0bba252978591fb2d74

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nh3-0.2.11-cp37-abi3-win32.whl
  • Upload date:
  • Size: 566.6 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.11-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 b6f40f836ecfa74f831d0c38c6ad62975d71c73fc00542f53a9df405186698fc
MD5 b02471dd6c399306f25b89d97b783161
BLAKE2b-256 211f827f94661009da80da9923691620df99ada5220819de878dc0d5acdd3f3a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.11-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 864bd3a69a64e273983bd54f3eb4e232fdc30526be08691d070b518d650854ea
MD5 6783a473ae20de34afb638d2994f827f
BLAKE2b-256 044f758216fd86d19cdcce67d31f125119a6397bb329109424c427ad11042ae5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.11-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 0773f08a9cb41aafa458ec5b45195b476fd4eff50aec6162c1ea368ca9bd07d1
MD5 4d866441ed3b11cff0ce56c72afee759
BLAKE2b-256 3f0574446587aff6999c79e889e3ba354c5d2de020fdf13a97eee3af45dd65d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.11-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 38321feba65a840714df332f5c6266a72ed50af2fbd5c03bf57d429acea2c07f
MD5 f0b29a0f34eda7c07a70aeeac94c2b33
BLAKE2b-256 430fdb1433e5adcad9ef8d676694cbf4a6e9a16f4171cdd6b379bb979f804338

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.11-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 5ce060ed5ee7783d2774c1939ac6285e3bce967598d8575042ba57fd7beded5e
MD5 b3f76d57dbfaefa6e6b726589878bb2d
BLAKE2b-256 e8894685f540fe88c8c40f9c4f9c4626dc920438000fe2a2af26b982cf3c1839

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.11-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 37c3b5788bb5035627547c27c6090f76f5157f6d79f13117241fe62cbed6f5eb
MD5 3a8d6b926169ebb01ae84d92e18d6724
BLAKE2b-256 d4e25d294998768a7b1d61728a03f94b151c2636cd7f095cac282720a33d7f0f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.11-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 9d396fc3438fb41871be44fbf12307ef3955b7ed7c82a87fccd325daf4122c31
MD5 b49b739e42ca1866256e1ec0e62ef37f
BLAKE2b-256 5f12cf0258a51a15909c9ec2c78ed97785c11a3b179f25f20735548c68b01ef4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.11-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 c5b8f5f7e126415873ca8d38e7c1be7369ec543d6d97ec89263495b24b95a30a
MD5 3e2f480d6c02b62271c4de213fb7b6ec
BLAKE2b-256 62b957c1abc026ebfc93a5779bd7997eebbfe34fe4cb4d13acfaf4e61802349c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.11-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 46798bced886ff382bdb2e6de2a52cc487d4c49ac058ae0701a2bf9e62155859
MD5 d336864e093d555620f8239a77fdd44a
BLAKE2b-256 6be5c020856a135a75674131b93888c3a617c451a86a968973051ed8cca3b55b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.11-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 e885b4504ac9c17582556a3c5a33b9289bd71d75e70887b3c70125cdd60c638e
MD5 ccf6206ba423eaa6dffe0f3a338be0a3
BLAKE2b-256 ca74896a2f2ddbf8eb2b890f1b67f002178f568f394d2b848b7bbb72e951161d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.11-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2e57b4be56a4551aa79b7c1ebfb381468c1014d29dcff65bf329504786ba062b
MD5 1b24101c328fc672b896466f0d7e1271
BLAKE2b-256 cf1c919346282cb8eb42ee2c6e7fd62ce41e59cee9d56dd728e0f57039868a41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.11-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 bff3b85abc0b34793190bc275bf52c496ee3d1710dc2388aaf8feadb63551af5
MD5 52f29caac34894513a3316a984c83539
BLAKE2b-256 fec00c43fc0f2b073758b7cb8e407423b10ff23f37fe303ad18979adcee8c039

See more details on using hashes here.

File details

Details for the file nh3-0.2.11-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.11-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 69073d7dd59e5e7a6dd2ae4e2b32846e8ab493afb0510d45e5d3935188dafa6f
MD5 951c66fe8a18454a5fba806401440ce6
BLAKE2b-256 42e05f3e336a41e85912921b38f3c9a58b5bdcab234827e1229f7413a15c7201

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.11-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 dec7807f3a5661678c8694475a477657323d43e69829193593e58d66ed1be0bb
MD5 b189fb4250f1fc5b1f27d9d9aabd6c01
BLAKE2b-256 55ef618d6bc1142e01228758027108a04d846ec7f24db1fa5f271e106d47a969

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