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

Uploaded Source

Built Distributions

nh3-0.2.21-cp313-cp313t-win_amd64.whl (528.9 kB view details)

Uploaded CPython 3.13tWindows x86-64

nh3-0.2.21-cp313-cp313t-win32.whl (532.7 kB view details)

Uploaded CPython 3.13tWindows x86

nh3-0.2.21-cp313-cp313t-musllinux_1_2_x86_64.whl (909.2 kB view details)

Uploaded CPython 3.13tmusllinux: musl 1.2+ x86-64

nh3-0.2.21-cp313-cp313t-musllinux_1_2_i686.whl (918.9 kB view details)

Uploaded CPython 3.13tmusllinux: musl 1.2+ i686

nh3-0.2.21-cp313-cp313t-musllinux_1_2_armv7l.whl (1.0 MB view details)

Uploaded CPython 3.13tmusllinux: musl 1.2+ ARMv7l

nh3-0.2.21-cp313-cp313t-musllinux_1_2_aarch64.whl (923.6 kB view details)

Uploaded CPython 3.13tmusllinux: musl 1.2+ ARM64

nh3-0.2.21-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (733.8 kB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.17+ x86-64

nh3-0.2.21-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.whl (760.0 kB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.5+ i686

nh3-0.2.21-cp313-cp313t-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.3 MB view details)

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

nh3-0.2.21-cp38-abi3-win_amd64.whl (535.3 kB view details)

Uploaded CPython 3.8+Windows x86-64

nh3-0.2.21-cp38-abi3-win32.whl (537.6 kB view details)

Uploaded CPython 3.8+Windows x86

nh3-0.2.21-cp38-abi3-musllinux_1_2_x86_64.whl (917.1 kB view details)

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

nh3-0.2.21-cp38-abi3-musllinux_1_2_i686.whl (925.7 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ i686

nh3-0.2.21-cp38-abi3-musllinux_1_2_armv7l.whl (1.0 MB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ ARMv7l

nh3-0.2.21-cp38-abi3-musllinux_1_2_aarch64.whl (930.6 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ ARM64

nh3-0.2.21-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (739.0 kB view details)

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

nh3-0.2.21-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (839.4 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ s390x

nh3-0.2.21-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (903.5 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ppc64le

nh3-0.2.21-cp38-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (944.9 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ppc64

nh3-0.2.21-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (747.0 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARMv7l

nh3-0.2.21-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (758.3 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

nh3-0.2.21-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl (768.7 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.5+ i686

nh3-0.2.21-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.3 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.2.21.tar.gz.

File metadata

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

File hashes

Hashes for nh3-0.2.21.tar.gz
Algorithm Hash digest
SHA256 4990e7ee6a55490dbf00d61a6f476c9a3258e31e711e13713b2ea7d6616f670e
MD5 8388f812c17898d2bf40aa454b741625
BLAKE2b-256 37302f81466f250eb7f591d4d193930df661c8c23e9056bdc78e365b646054d8

See more details on using hashes here.

File details

Details for the file nh3-0.2.21-cp313-cp313t-win_amd64.whl.

File metadata

  • Download URL: nh3-0.2.21-cp313-cp313t-win_amd64.whl
  • Upload date:
  • Size: 528.9 kB
  • Tags: CPython 3.13t, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.2

File hashes

Hashes for nh3-0.2.21-cp313-cp313t-win_amd64.whl
Algorithm Hash digest
SHA256 713d16686596e556b65e7f8c58328c2df63f1a7abe1277d87625dcbbc012ef82
MD5 1a92a643d674109e5f40629d6e54f49f
BLAKE2b-256 a23a96eb26c56cbb733c0b4a6a907fab8408ddf3ead5d1b065830a8f6a9c3557

See more details on using hashes here.

File details

Details for the file nh3-0.2.21-cp313-cp313t-win32.whl.

File metadata

  • Download URL: nh3-0.2.21-cp313-cp313t-win32.whl
  • Upload date:
  • Size: 532.7 kB
  • Tags: CPython 3.13t, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.2

File hashes

Hashes for nh3-0.2.21-cp313-cp313t-win32.whl
Algorithm Hash digest
SHA256 637d4a10c834e1b7d9548592c7aad760611415fcd5bd346f77fd8a064309ae6d
MD5 5b8fb842f5101525a43550409f9d0e1c
BLAKE2b-256 261693309693f8abcb1088ae143a9c8dbcece9c8f7fb297d492d3918340c41f1

See more details on using hashes here.

File details

Details for the file nh3-0.2.21-cp313-cp313t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for nh3-0.2.21-cp313-cp313t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b3b5c58161e08549904ac4abd450dacd94ff648916f7c376ae4b2c0652b98ff9
MD5 e458ac95b29179ee9e098e3fe5956f7a
BLAKE2b-256 d7da0279c118f8be2dc306e56819880b19a1cf2379472e3b79fc8eab44e267e3

See more details on using hashes here.

File details

Details for the file nh3-0.2.21-cp313-cp313t-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for nh3-0.2.21-cp313-cp313t-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 818f2b6df3763e058efa9e69677b5a92f9bc0acff3295af5ed013da544250d5b
MD5 5605493a111df5706984c5fba445c940
BLAKE2b-256 68a948479dbf5f49ad93f0badd73fbb48b3d769189f04c6c69b0df261978b009

See more details on using hashes here.

File details

Details for the file nh3-0.2.21-cp313-cp313t-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for nh3-0.2.21-cp313-cp313t-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 55823c5ea1f6b267a4fad5de39bc0524d49a47783e1fe094bcf9c537a37df251
MD5 e9f2f694ab500e1bb8c7ef554e2e3f7a
BLAKE2b-256 29c7269a7cfbec9693fad8d767c34a755c25ccb8d048fc1dfc7a7d86bc99375c

See more details on using hashes here.

File details

Details for the file nh3-0.2.21-cp313-cp313t-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for nh3-0.2.21-cp313-cp313t-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 9d67709bc0d7d1f5797b21db26e7a8b3d15d21c9c5f58ccfe48b5328483b685b
MD5 f3eb34e16c774af4f81ac452a677e1af
BLAKE2b-256 97901182275db76cd8fbb1f6bf84c770107fafee0cb7da3e66e416bcb9633da2

See more details on using hashes here.

File details

Details for the file nh3-0.2.21-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nh3-0.2.21-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 31eedcd7d08b0eae28ba47f43fd33a653b4cdb271d64f1aeda47001618348fde
MD5 7af0ada632a909386780018126289f09
BLAKE2b-256 22eed0ad8fb4b5769f073b2df6807f69a5e57ca9cea504b78809921aef460d20

See more details on using hashes here.

File details

Details for the file nh3-0.2.21-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for nh3-0.2.21-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 d426d7be1a2f3d896950fe263332ed1662f6c78525b4520c8e9861f8d7f0d243
MD5 45d96b174f17c71fb3faa8664e7eff03
BLAKE2b-256 ea76b450141e2d384ede43fe53953552f1c6741a499a8c20955ad049555cabc8

See more details on using hashes here.

File details

Details for the file nh3-0.2.21-cp313-cp313t-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for nh3-0.2.21-cp313-cp313t-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 fcff321bd60c6c5c9cb4ddf2554e22772bb41ebd93ad88171bbbb6f271255286
MD5 f21eb56fedaea041444fe88992757285
BLAKE2b-256 7f81b83775687fcf00e08ade6d4605f0be9c4584cb44c4973d9f27b7456a31c9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nh3-0.2.21-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 bb0014948f04d7976aabae43fcd4cb7f551f9f8ce785a4c9ef66e6c2590f8629
MD5 c77a3d902eb5fca172789c6683a586be
BLAKE2b-256 23fc8ce756c032c70ae3dd1d48a3552577a325475af2a2f629604b44f571165c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nh3-0.2.21-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 6c9c30b8b0d291a7c5ab0967ab200598ba33208f754f2f4920e9343bdd88f79a
MD5 654b1b45e795b99bc10471d038c57cf5
BLAKE2b-256 e7d8c6f977a5cd4011c914fb58f5ae573b071d736187ccab31bfb1d539f4af9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.21-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a7ea28cd49293749d67e4fcf326c554c83ec912cd09cd94aa7ec3ab1921c8283
MD5 a4e2d26766d00c0a065f98ad7efbec75
BLAKE2b-256 3d79bdba276f58d15386a3387fe8d54e980fb47557c915f5448d8c6ac6f7ea9b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.21-cp38-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 20979783526641c81d2f5bfa6ca5ccca3d1e4472474b162c6256745fbfe31cd1
MD5 25df1f194f3255144dddcefdece4e036
BLAKE2b-256 a6df01b05299f68c69e480edff608248313cbb5dbd7595c5e048abe8972a57f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.21-cp38-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 6141caabe00bbddc869665b35fc56a478eb774a8c1dfd6fba9fe1dfdf29e6efa
MD5 4b5139967ccc3f0ef8eb1b23756422fd
BLAKE2b-256 789d6f5369a801d3a1b02e6a9a097d56bcc2f6ef98cffebf03c4bb3850d8e0f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.21-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 ac7006c3abd097790e611fe4646ecb19a8d7f2184b882f6093293b8d9b887431
MD5 6d4d116069e0a68e85dc642c719f2105
BLAKE2b-256 9eaacfc0bf545d668b97d9adea4f8b4598667d2b21b725d83396c343ad12bba7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.21-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a5f77e62aed5c4acad635239ac1290404c7e940c81abe561fd2af011ff59f585
MD5 0d76ff66b840a2b29b1d3bbefdb8e06e
BLAKE2b-256 11a91cd3c6964ec51daed7b01ca4686a5c793581bf4492cbd7274b3f544c9abe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.21-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 63ca02ac6f27fc80f9894409eb61de2cb20ef0a23740c7e29f9ec827139fa578
MD5 d355463ef5c4a6d07f37e68c24d303a0
BLAKE2b-256 cdc3d4f8037b2ab02ebf5a2e8637bd54736ed3d0e6a2869e10341f8d9085f00e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.21-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 6ae319f17cd8960d0612f0f0ddff5a90700fa71926ca800e9028e7851ce44a6f
MD5 db1e41e1eb7e2848f46b93f20695c1e1
BLAKE2b-256 79d4dc76f5dc50018cdaf161d436449181557373869aacf38a826885192fc587

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.21-cp38-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 b8d55ea1fc7ae3633d758a92aafa3505cd3cc5a6e40470c9164d54dff6f96d42
MD5 d636a71e07bdba0aaf973dd726f744a7
BLAKE2b-256 759906a6ba0b8a0d79c3d35496f19accc58199a1fb2dce5e711a31be7e2c1426

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.21-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 2a5174551f95f2836f2ad6a8074560f261cf9740a48437d6151fd2d4d7d617ab
MD5 7bdf0c05dbac4feb49a2e25851aae318
BLAKE2b-256 6dad07bd706fcf2b7979c51b83d8b8def28f413b090cf0cb0035ee6b425e9de5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.21-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d002b648592bf3033adfd875a48f09b8ecc000abd7f6a8769ed86b6ccc70c759
MD5 dcbbdffd028145391f7c8ed41b907970
BLAKE2b-256 b8f22c7f79ce6de55b41e7715f7f59b159fd59f6cdb66223c05b42adaee2b645

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.21-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 087ffadfdcd497658c3adc797258ce0f06be8a537786a7217649fc1c0c60c293
MD5 81606118548bcb8b9418a5743aac7f5c
BLAKE2b-256 fd04bfb3ff08d17a8a96325010ae6c53ba41de6248e63cdb1b88ef6369a6cdfc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.21-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 a772dec5b7b7325780922dd904709f0f5f3a79fbf756de5291c01370f6df0967
MD5 cbee3e7715c10010a7cde255afd9fc9a
BLAKE2b-256 ba1db1ef74121fe325a69601270f276021908392081f4953d50b03cbb38b395f

See more details on using hashes here.

Supported by

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