Skip to main content

Python bindings to the ammonia HTML sanitization library.

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

Uploaded Source

Built Distributions

nh3-0.2.16-cp37-abi3-win_amd64.whl (569.0 kB view details)

Uploaded CPython 3.7+ Windows x86-64

nh3-0.2.16-cp37-abi3-win32.whl (569.9 kB view details)

Uploaded CPython 3.7+ Windows x86

nh3-0.2.16-cp37-abi3-musllinux_1_2_x86_64.whl (1.7 MB view details)

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

nh3-0.2.16-cp37-abi3-musllinux_1_2_i686.whl (1.7 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ i686

nh3-0.2.16-cp37-abi3-musllinux_1_2_armv7l.whl (1.8 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARMv7l

nh3-0.2.16-cp37-abi3-musllinux_1_2_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARM64

nh3-0.2.16-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (779.3 kB view details)

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

nh3-0.2.16-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (938.0 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ s390x

nh3-0.2.16-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (833.1 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ppc64le

nh3-0.2.16-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (878.3 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ppc64

nh3-0.2.16-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (776.4 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARMv7l

nh3-0.2.16-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (840.7 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARM64

nh3-0.2.16-cp37-abi3-manylinux_2_12_i686.manylinux2010_i686.whl (780.4 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.12+ i686

nh3-0.2.16-cp37-abi3-macosx_10_12_x86_64.whl (681.5 kB view details)

Uploaded CPython 3.7+ macOS 10.12+ x86-64

nh3-0.2.16-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.4 MB view details)

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

File details

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

File metadata

  • Download URL: nh3-0.2.16.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for nh3-0.2.16.tar.gz
Algorithm Hash digest
SHA256 c93a95f3f414ad31bbdd88f47422d6f3f3012ab8b90bdf318ca2795c1c959422
MD5 d5d93bdd7abd45d5f7433dacfba13ad0
BLAKE2b-256 fd72267d3e6f6e78601ddf1907fd4bda68b12f84276d2cde5eea369b98db79ce

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nh3-0.2.16-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 7e4fe20fd4cc05b45581d73752badcd3706fc1c54f9da977d8a7897673908a1c
MD5 0e188bf97f585d4d4fd0a0f8fca50bb2
BLAKE2b-256 e90b5650f31eb518ce1982e86ec8be8c5957052b16a878390b1244236a061f00

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nh3-0.2.16-cp37-abi3-win32.whl
  • Upload date:
  • Size: 569.9 kB
  • Tags: CPython 3.7+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for nh3-0.2.16-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 6d7c71c91f16474fdb92a595c8fd5ed7baa393c67526ae56bdcbfb091dfb91d3
MD5 8c85289d33bb10bc79c329bd77301fda
BLAKE2b-256 ba998f95a6ad4d8ec49d85ac5b1622ec32af49231e05e1cfd8d3ca9728147896

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.16-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 261a5fff021e9ce3b233478d252ecaf150d09f1f03a08d3ab2fa508c37d101b8
MD5 a5f15f27bb920fcb5f5d3bd84e369954
BLAKE2b-256 ef7d0faeea2cb8e3c0c61d547ccccf2c634443ff0fd512cbf1af69d9f067de8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.16-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 7c308f71f01bf78c054f93392cec14cd9c523a371b26f0bdae9aef3b38106560
MD5 0ba8401521964322063a8b29f2a72a88
BLAKE2b-256 a0b3084b117b9f8c3860287e47add682b16cf18d84d4ce9b76548976088209d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.16-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 fbf7e8caae2484d8d05e23d406531a0ef8abe791ca72585db71da357ffdf123c
MD5 78ae742ee37e512ea48d54a344cde909
BLAKE2b-256 f1ce8ff715a18ca16bc0cdf1aae349e46cef65bfd015e52cc38bf93e03f7d89e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.16-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 3d2cb26f0659583074abff8b5d220f182ee4e11698ccd7e38e3a8da5f136036c
MD5 98f199d4c82e931f464d937ed2e53084
BLAKE2b-256 dc1069a7ac14c97184f735c0b8097338611d461cd0d005cb0f218ee5b140d423

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.16-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a00d298fa2ea147ff5765d156a6d3351ca16ae111620e97d06b20f6184ef9618
MD5 eef9131f9fb715ea98f9999cd0dfa02b
BLAKE2b-256 3f5c8bad3d71a7b5c64f9f27ab9644239f74d88078a23f761989f96bd46f8905

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.16-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 3a056e757d659e77d8e0b0b2d837f2d757162bcc1c6a41fcb696c5745ed8b3fa
MD5 c9ae3df476dfaa6b6f0fac8e005ba755
BLAKE2b-256 22dbe7c9c9aed565ea61ef78e9de1ef7d8780fef0c0cc9293e53d5f320da1880

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.16-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 c2133a81c4117cf85591605d2c954cb932549698a22efd6bca7e05e7860b3966
MD5 495d6f9ac28265b81a32f68c1369c68c
BLAKE2b-256 fa034a0631bcc1065952cfce3bc02da1937a3b679d7379665576ed8594d6f64f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.16-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 a9bf67bb4cafd793a0f778d2b8bdb910ffdd55f789b7b69efc8667b96344e99f
MD5 ce82fd078a2f22948cf6f44d32933f60
BLAKE2b-256 952b3248c71e4caf44f6aa77f4bf9664aa498475db0032548a5ed328c33033cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.16-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 ebf5a77dfd495e8240971d0a2009c1ee0f787c2f8d140641cf9791fcc2a2bcad
MD5 67319aa3de11465c0497b8d66aff29ae
BLAKE2b-256 4d60eabcb23b8d8335b88643bbccbd908baa5dcb4796e30780d5001b41f7d105

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.16-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6395124754d144fc5bebc60dc4dbc47d53cf05e8469a0ecb96f938a9747c009e
MD5 475237c5347d7214d00f05b092e042fd
BLAKE2b-256 a3f59ebb388da9b72560d2596091c24fb71061345f4d516b6fb96de45173646b

See more details on using hashes here.

File details

Details for the file nh3-0.2.16-cp37-abi3-manylinux_2_12_i686.manylinux2010_i686.whl.

File metadata

File hashes

Hashes for nh3-0.2.16-cp37-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 c7011c4f6ce706ed975f876e7f3c0110b6d2b73404b48b015507d2d474891b18
MD5 233e33a9bcb95ff33985501d0dca1ae5
BLAKE2b-256 2e7e7ab52ae15f97000a099e750f7bb5a36e2ff32d540e3d2f62450077d0df1b

See more details on using hashes here.

File details

Details for the file nh3-0.2.16-cp37-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for nh3-0.2.16-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 89f9e968f5ddb8a1e782e9bdc12af7b68e340a8d2c2e8289aa943f784020da49
MD5 8a4f38e8c886ff7a18a3eeca9657fdb1
BLAKE2b-256 b0b77fa966d50cf421783031c1bd2a18f4fa87466158aac105efdcfffa1a3c05

See more details on using hashes here.

File details

Details for the file nh3-0.2.16-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for nh3-0.2.16-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 073f92c652d3c35b736bf7d4801e6c7bd545fb04d6d45d916bc9e6069069b5dc
MD5 27207fb179a6e92486cf422ffc0ab4be
BLAKE2b-256 d5a0e45b192451c6212643e20fe4cf5c1d5a62439bcd6be7b3b17959fbe4e2bb

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