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

Uploaded Source

Built Distributions

nh3-0.2.9-cp37-abi3-win_amd64.whl (568.8 kB view details)

Uploaded CPython 3.7+ Windows x86-64

nh3-0.2.9-cp37-abi3-win32.whl (568.6 kB view details)

Uploaded CPython 3.7+ Windows x86

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

Uploaded CPython 3.7+ musllinux: musl 1.2+ i686

nh3-0.2.9-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.9-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.9-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.9-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.9-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.9-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.9-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl (1.6 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.5+ i686

nh3-0.2.9-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.9-cp37-abi3-macosx_10_7_x86_64.whl (725.3 kB view details)

Uploaded CPython 3.7+ macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: nh3-0.2.9.tar.gz
  • Upload date:
  • Size: 14.0 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.9.tar.gz
Algorithm Hash digest
SHA256 869fadb17926c1140de322d65ae2f35bf8908f4229b6f32321daf8ca3dbdafd1
MD5 cb61c85076cd10b32193dc3e12c7611d
BLAKE2b-256 2bfd25ed19991d7513c60041351dea0d054294d074d68712830bdb800f19aee8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nh3-0.2.9-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 568.8 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.9-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c8330040b0ddba450f54efaeaca41d25ef01e933781ecae8c93d613d05f06c5a
MD5 c487553bffbefe28475e9892ffef2689
BLAKE2b-256 2546dddfbc816ae664065fb826a91e0ac2a7aa3dcccb68d331324507e3880055

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nh3-0.2.9-cp37-abi3-win32.whl
  • Upload date:
  • Size: 568.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.9-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 a0ab36ed99a63fad4c9867e575fdb41903eda1894027329527b3fff2f5595928
MD5 8d95a9c70857fc14c2dbdf776716b3c5
BLAKE2b-256 01053dc0c5ce57bfc0a7699dfc6472041c834365d99fc163cbf0bf3f8044eb11

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.9-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 359ee983e2409f1cf75558d8652d239082fa5821354bdcf67d8415249eae68bd
MD5 ec13d5d3dec78395edc02991b7819372
BLAKE2b-256 4b2a2204ed5fd0e7b699c126067c13a5c25413528d26a5e472f456484c978bba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nh3-0.2.9-cp37-abi3-musllinux_1_2_i686.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.7+, musllinux: musl 1.2+ i686
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for nh3-0.2.9-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 16ff439069cea3cce468a73cf7c7353b6e626014286fc204c8fcd99e14a8f66c
MD5 d34c6c9fe5a2f7f4176ffea92df38b9a
BLAKE2b-256 36da3b58559cff7725adbc6c2c588654f36f250dbcc5398f5a5fdc8f610c07a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.9-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3f7c7e9300f105df9823f8881bb6f786c8e17aa1761e7272fc349785a7f7523b
MD5 9acc74bda0a88152f24bb35439686e31
BLAKE2b-256 52beeea11c0569a6022c6bd95f548c5d85598e7851f393c7d9893a085ec74e9b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.9-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 96f009c489d87d6668866273973cf56dc341512214ab9543b4f75283858d146d
MD5 814238d6319fa001f88fd2500b0dadb2
BLAKE2b-256 e64af253f6e5e1ce242ed4c8e0f00ba866724cd121e5adf0a9c4ddf689d10677

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.9-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 c79e1692b65d6160cbbc599f01ac15e49d9be8408cd26e5f76928db1432a6c9a
MD5 ae2c78c7f0b2333ced024ee3acfe480e
BLAKE2b-256 2f07f16326389b3323b5d544a9aab7307975ca6596c99a27f612199326c344f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.9-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 dc2606d4ae082972825331039826c2af2fe6d874177581f4eb520d4704fada58
MD5 6633566fb7dcaf007120b22046e1ea95
BLAKE2b-256 9d67cb74a4aae6afde92ba92ab61ff4939320e935964b75775c4d812b8af41c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.9-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 abaca948e1a83b96fc7c5f8dc021e321d6c21ec15af8e3ba2dc3b3615bc0d1a7
MD5 7a85feaccfa55d6be77a5d42a4a83974
BLAKE2b-256 62c5fc70e2c1752600db76a2cd15e605bb4d51f8d9e46cb327f22b49a936c546

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.9-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5c5f49a6664fd829d4c717a4df9264b1342ed3692af30b387c4214575db19c09
MD5 a3cede7fe6e090d8cbb95f6a1149d820
BLAKE2b-256 16d163cd6be27ff20038b8243eaaf809026745875fa026bc3617d52eda1ca299

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.9-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 9d7907074de1659a91fdd662055e175ffd43c8811107edcd58b74b16cb8c0c84
MD5 0fd29f1c251dcddbf9813d0136fba576
BLAKE2b-256 3994de45f069a7a1682ce853ce16aef9c602f256fb53b1d94da9aee946142cb5

See more details on using hashes here.

File details

Details for the file nh3-0.2.9-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.9-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 8928026fecdd641ca05dc38731de2f215469f1ede52ca973db2625be371befd9
MD5 e7de74a0e6391558e5eef4b6e22a3caa
BLAKE2b-256 ecfc29c8f238470b383f4cb44c9d8ce01c158375e67521862c9a628941ecf007

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nh3-0.2.9-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 3a5ed086a794d369f945843afc797103f2277cffb6fc17c0fd49a1eb81c30706
MD5 01e52276a2906e0cc85fba165c76f67b
BLAKE2b-256 b167bf2da33978ae072ed754d085b69f8033564fada4c76664619a083cefb8f6

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