🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

htmlpyever

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

htmlpyever

Python bindings to html5ever

0.1.0.post3
PyPI
Maintainers
1

htmlpyever

htmlpyever is a very single-minded binding to html5ever. You can:

  • Feed the parser:

    .. code-block:: python

    parser.feed(b'hOI wURLD!')

  • Get a callback when the parser encounters a closing script tag:

    .. code-block:: python

    def script_callback(script): # handle script parser = htmlpyever.Parser(script_callback)

    or

    class MyParser(htmlpyever.Parser): def run_script(self, script) # handle script parser = MyParser()

  • Obtain the result as an LXML Element or ElementTree:

    .. code-block:: python

    from lxml import etree etree.tostring(parser.root)

    >>> 'hOI! wURLD!'

    etree.tostring(parser.root)

    >>> 'hOI! wURLD!'

    not sure why the doctype doesn't show up in the serialized ElementTree

That's it.

Keywords

html

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts