Skip to main content

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

  • Feed the parser:

    parser.feed(b'hOI wURLD!')
  • Get a callback when the parser encounters a closing script tag:

    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:

    from lxml import etree
    etree.tostring(parser.root)
    # >>> '<html><head/><body>hOI! wURLD!</body></html>'
    etree.tostring(parser.root)
    # >>> '<html><head/><body>hOI! wURLD!</body></html>'
    # not sure why the doctype doesn't show up in the serialized ElementTree

That’s it.

Release files for htmlpyever 0.1.0.post3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for htmlpyever 0.1.0.post3
File Size Uploaded
htmlpyever-0.1.0.post3.tar.gz 49.3 kB Details

Release files / htmlpyever-0.1.0.post3.tar.gz

Download URL htmlpyever-0.1.0.post3.tar.gz
Size 49.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d09e54287be121c87abf238425aaeedb307e6f78b1c0daf6236047b4c375b943
BLAKE2b-256 checksum
How to use checksums
1a9cde8e025029299fa7e9c4ba55860673826e645a16dfa692d5fa86c998e977
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.0.post3 This release

1 release file

0.1.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page