Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

  pip install py_w3c

  1. As library - 

    # import HTML validator
    from py_w3c.validators.html.validator import HTMLValidator

    # create validator instance
    vld = HTMLValidator()

    # validate

    # look for errors
    print vld.errors  # list with dicts

    # look for warnings
    print vld.warnings

  There are 3 methods of validating:
    1. validate url - HTMLValidator().validate(url)
    2. validate file - HTMLValidator().validate_file(filename_or_file) # StringIO aware.
    3. validate fragment - HTMLValidator().validate_fragment(fragment_string)

  You can pass charset or doctype while creating validator instance. This will force validator to use passed doctype or charset for validation.
      vld = HTMLValidator(doctype="XHTML1", charset="utf-8")

      # now validator uses XHTML1 doctype and utf-8 charset ignoring doctype and charset in the document content

  2. As standalone script - (not very usefull right now)
    Now only url validating is allowed for standalone script.
    Prints warnings and errors to the console.

Recent activity


nmb10 uploaded file py_w3c-v0.1.1.tar.gz to py_w3c

File has been deleted.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.