Skip to main content

Python binding to Ammonia HTML sanitizer Rust crate

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

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

nh3-0.3.2-cp314-cp314t-win_arm64.whl (577.1 kB view details)

Uploaded CPython 3.14tWindows ARM64

nh3-0.3.2-cp314-cp314t-win_amd64.whl (590.0 kB view details)

Uploaded CPython 3.14tWindows x86-64

nh3-0.3.2-cp314-cp314t-win32.whl (583.4 kB view details)

Uploaded CPython 3.14tWindows x86

nh3-0.3.2-cp314-cp314t-musllinux_1_2_x86_64.whl (976.0 kB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

nh3-0.3.2-cp314-cp314t-musllinux_1_2_i686.whl (994.7 kB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ i686

nh3-0.3.2-cp314-cp314t-musllinux_1_2_armv7l.whl (1.1 MB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ ARMv7l

nh3-0.3.2-cp314-cp314t-musllinux_1_2_aarch64.whl (997.1 kB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ ARM64

nh3-0.3.2-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (791.2 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ x86-64

nh3-0.3.2-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl (829.1 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.5+ i686

nh3-0.3.2-cp314-cp314t-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.4 MB view details)

Uploaded CPython 3.14tmacOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

nh3-0.3.2-cp38-abi3-win_arm64.whl (584.2 kB view details)

Uploaded CPython 3.8+Windows ARM64

nh3-0.3.2-cp38-abi3-win_amd64.whl (596.4 kB view details)

Uploaded CPython 3.8+Windows x86-64

nh3-0.3.2-cp38-abi3-win32.whl (589.8 kB view details)

Uploaded CPython 3.8+Windows x86

nh3-0.3.2-cp38-abi3-musllinux_1_2_x86_64.whl (987.4 kB view details)

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

nh3-0.3.2-cp38-abi3-musllinux_1_2_i686.whl (1.0 MB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ i686

nh3-0.3.2-cp38-abi3-musllinux_1_2_armv7l.whl (1.1 MB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ ARMv7l

nh3-0.3.2-cp38-abi3-musllinux_1_2_aarch64.whl (1.0 MB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ ARM64

nh3-0.3.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (797.2 kB view details)

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

nh3-0.3.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (911.7 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ s390x

nh3-0.3.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.0 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ppc64le

nh3-0.3.2-cp38-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (1.1 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ppc64

nh3-0.3.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (803.5 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARMv7l

nh3-0.3.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (820.8 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

nh3-0.3.2-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl (838.6 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.5+ i686

nh3-0.3.2-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.4 MB view details)

Uploaded CPython 3.8+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: nh3-0.3.2.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.6

File hashes

Hashes for nh3-0.3.2.tar.gz
Algorithm Hash digest
SHA256 f394759a06df8b685a4ebfb1874fb67a9cbfd58c64fc5ed587a663c0e63ec376
MD5 f1dbd8fe8b87fb4e56318cdb17006d8e
BLAKE2b-256 caa534c26015d3a434409f4d2a1cd8821a06c05238703f49283ffeb937bef093

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp314-cp314t-win_arm64.whl.

File metadata

  • Download URL: nh3-0.3.2-cp314-cp314t-win_arm64.whl
  • Upload date:
  • Size: 577.1 kB
  • Tags: CPython 3.14t, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.6

File hashes

Hashes for nh3-0.3.2-cp314-cp314t-win_arm64.whl
Algorithm Hash digest
SHA256 019ecbd007536b67fdf76fab411b648fb64e2257ca3262ec80c3425c24028c80
MD5 c27d07c617a1c14a6edc4d022763932f
BLAKE2b-256 b4bdc7d862a4381b95f2469704de32c0ad419def0f4a84b7a138a79532238114

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp314-cp314t-win_amd64.whl.

File metadata

  • Download URL: nh3-0.3.2-cp314-cp314t-win_amd64.whl
  • Upload date:
  • Size: 590.0 kB
  • Tags: CPython 3.14t, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.6

File hashes

Hashes for nh3-0.3.2-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 dce4248edc427c9b79261f3e6e2b3ecbdd9b88c267012168b4a7b3fc6fd41d13
MD5 dc5bccdefa2b20b2bb147573be3ca9b7
BLAKE2b-256 94ae95c52b5a75da429f11ca8902c2128f64daafdc77758d370e4cc310ecda55

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp314-cp314t-win32.whl.

File metadata

  • Download URL: nh3-0.3.2-cp314-cp314t-win32.whl
  • Upload date:
  • Size: 583.4 kB
  • Tags: CPython 3.14t, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.6

File hashes

Hashes for nh3-0.3.2-cp314-cp314t-win32.whl
Algorithm Hash digest
SHA256 1f9ba555a797dbdcd844b89523f29cdc90973d8bd2e836ea6b962cf567cadd93
MD5 78a6ce7f22350ea8966d7dfd5b8cdfbb
BLAKE2b-256 3430ebf8e2e8d71fdb5a5d5d8836207177aed1682df819cbde7f42f16898946c

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for nh3-0.3.2-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a40202fd58e49129764f025bbaae77028e420f1d5b3c8e6f6fd3a6490d513868
MD5 723be6cafaec7dcc2d1bba99ef45a830
BLAKE2b-256 796690190033654f1f28ca98e3d76b8be1194505583f9426b0dcde782a3970a2

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp314-cp314t-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for nh3-0.3.2-cp314-cp314t-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 0fe7ee035dd7b2290715baf29cb27167dddd2ff70ea7d052c958dbd80d323c99
MD5 994d65fb7b90fa3f6cea215e2ce7c1b8
BLAKE2b-256 8764bdd9631779e2d588b08391f7555828f352e7f6427889daf2fa424bfc90c9

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp314-cp314t-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for nh3-0.3.2-cp314-cp314t-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 0dca4365db62b2d71ff1620ee4f800c4729849906c5dd504ee1a7b2389558e31
MD5 617eaed21f0575dd53277f2f9d3a1dc0
BLAKE2b-256 41eefd8140e4df9d52143e89951dd0d797f5546004c6043285289fbbe3112293

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp314-cp314t-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for nh3-0.3.2-cp314-cp314t-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 403c11563e50b915d0efdb622866d1d9e4506bce590ef7da57789bf71dd148b5
MD5 988c61387c6433ad232abd970e0bfa34
BLAKE2b-256 d89777aef4daf0479754e8e90c7f8f48f3b7b8725a3b8c0df45f2258017a6895

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nh3-0.3.2-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 45c953e57028c31d473d6b648552d9cab1efe20a42ad139d78e11d8f42a36130
MD5 c18f8e5bf8cafac9f3f9b1d6abafa31e
BLAKE2b-256 305707826ff65d59e7e9cc789ef1dc405f660cabd7458a1864ab58aefa17411b

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for nh3-0.3.2-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 2c9850041b77a9147d6bbd6dbbf13eeec7009eb60b44e83f07fcb2910075bf9b
MD5 8d461b204b0abec4b1d89d8ac8bc76d0
BLAKE2b-256 af2fe8a86f861ad83f3bb5455f596d5c802e34fcdb8c53a489083a70fd301333

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp314-cp314t-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for nh3-0.3.2-cp314-cp314t-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 d18957a90806d943d141cc5e4a0fefa1d77cf0d7a156878bf9a66eed52c9cc7d
MD5 a6e819d9e04b5d4c850aacd375d316cd
BLAKE2b-256 5b01a1eda067c0ba823e5e2bb033864ae4854549e49fb6f3407d2da949106bfb

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp38-abi3-win_arm64.whl.

File metadata

  • Download URL: nh3-0.3.2-cp38-abi3-win_arm64.whl
  • Upload date:
  • Size: 584.2 kB
  • Tags: CPython 3.8+, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.6

File hashes

Hashes for nh3-0.3.2-cp38-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 cf5964d54edd405e68583114a7cba929468bcd7db5e676ae38ee954de1cfc104
MD5 12fbdc2858e391182bc69c042a33991d
BLAKE2b-256 9e7ea96255f63b7aef032cbee8fc4d6e37def72e3aaedc1f72759235e8f13cb1

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: nh3-0.3.2-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 596.4 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.6

File hashes

Hashes for nh3-0.3.2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 562da3dca7a17f9077593214a9781a94b8d76de4f158f8c895e62f09573945fe
MD5 201add7a5a47a14546f4603f46c54d98
BLAKE2b-256 649a1a1c154f10a575d20dd634e5697805e589bbdb7673a0ad00e8da90044ba7

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp38-abi3-win32.whl.

File metadata

  • Download URL: nh3-0.3.2-cp38-abi3-win32.whl
  • Upload date:
  • Size: 589.8 kB
  • Tags: CPython 3.8+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.6

File hashes

Hashes for nh3-0.3.2-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 169db03df90da63286e0560ea0efa9b6f3b59844a9735514a1d47e6bb2c8c61b
MD5 1cf2196b75968eea0059c7b1232063a8
BLAKE2b-256 0d952d6fc6461687d7a171f087995247dec33e8749a562bfadd85fb5dbf37a11

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp38-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for nh3-0.3.2-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 91e9b001101fb4500a2aafe3e7c92928d85242d38bf5ac0aba0b7480da0a4cd6
MD5 a3dd80a4563a982e1751c076875181cb
BLAKE2b-256 e2c897a2d5f7a314cce2c5c49f30c6f161b7f3617960ade4bfc2fd1ee092cb20

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp38-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for nh3-0.3.2-cp38-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 1710f3901cd6440ca92494ba2eb6dc260f829fa8d9196b659fa10de825610ce0
MD5 8651ddd8aed106689f26b788c0cb6d56
BLAKE2b-256 b0c6966aec0cb4705e69f6c3580422c239205d5d4d0e50fac380b21e87b6cf1b

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp38-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for nh3-0.3.2-cp38-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 2ab70e8c6c7d2ce953d2a58102eefa90c2d0a5ed7aa40c7e29a487bc5e613131
MD5 5962b28ad6f59fdc7fdce29bf3db9e1b
BLAKE2b-256 b6618f4d41c4ccdac30e4b1a4fa7be4b0f9914d8314a5058472f84c8e101a418

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp38-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for nh3-0.3.2-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 f97f8b25cb2681d25e2338148159447e4d689aafdccfcf19e61ff7db3905768a
MD5 775a3deb811aed94c87dbc065c751dd4
BLAKE2b-256 d109deb57f1fb656a7a5192497f4a287b0ade5a2ff6b5d5de4736d13ef6d2c1f

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nh3-0.3.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7bb18403f02b655a1bbe4e3a4696c2ae1d6ae8f5991f7cacb684b1ae27e6c9f7
MD5 a5c8eb07231840cdd03bf3bd10044751
BLAKE2b-256 420fc76bf3dba22c73c38e9b1113b017cf163f7696f50e003404ec5ecdb1e8a6

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for nh3-0.3.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 f2f55c4d2d5a207e74eefe4d828067bbb01300e06e2a7436142f915c5928de07
MD5 4fb9be6814f1b65767b15363e83a45c0
BLAKE2b-256 537ff17e0dba0a99cee29e6cee6d4d52340ef9cb1f8a06946d3a01eb7ec2fb01

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for nh3-0.3.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 03d617e5c8aa7331bd2659c654e021caf9bba704b109e7b2b28b039a00949fe5
MD5 574553879f0326924282da828c82c137
BLAKE2b-256 faf75728e3b32a11daf5bd21cf71d91c463f74305938bc3eb9e0ac1ce141646e

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp38-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl.

File metadata

File hashes

Hashes for nh3-0.3.2-cp38-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 13398e676a14d6233f372c75f52d5ae74f98210172991f7a3142a736bd92b131
MD5 49c0a891924f19cf6199e6789ce6680b
BLAKE2b-256 4acaf022273bab5440abff6302731a49410c5ef66b1a9502ba3fbb2df998d9ff

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for nh3-0.3.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 72d67c25a84579f4a432c065e8b4274e53b7cf1df8f792cf846abfe2c3090866
MD5 f33fe34c37a655e8347053cc1fb941ec
BLAKE2b-256 3d6219b7c50ccd1fa7d0764822d2cea8f2a320f2fd77474c7a1805cb22cf69b0

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nh3-0.3.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c8745454cdd28bbbc90861b80a0111a195b0e3961b9fa2e672be89eb199fa5d8
MD5 ed789fab80ea523ce08f761aa4d71d56
BLAKE2b-256 7ff7529a99324d7ef055de88b690858f4189379708abae92ace799365a797b7f

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for nh3-0.3.2-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 6d66f41672eb4060cf87c037f760bdbc6847852ca9ef8e9c5a5da18f090abf87
MD5 050290ab26f56530fdaa9850052b283e
BLAKE2b-256 08a173d8250f888fb0ddf1b119b139c382f8903d8bb0c5bd1f64afc7e38dad1d

See more details on using hashes here.

File details

Details for the file nh3-0.3.2-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for nh3-0.3.2-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 7064ccf5ace75825bd7bf57859daaaf16ed28660c1c6b306b649a9eda4b54b1e
MD5 dbd31367344824be644fe574cd40d2b0
BLAKE2b-256 b63ef5a5cc2885c24be13e9b937441bd16a012ac34a657fe05e58927e8af8b7a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page