Skip to main content
Installation:
pip install py_w3c

Usage:
1. As library -

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

# create validator instance
vld = HTMLValidator()

# validate
vld.validate("http://datetostr.org")

# 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.
Example.
vld = HTMLValidator(doctype="XHTML1", charset="utf-8")

# now validator uses XHTML1 doctype and utf-8 charset ignoring doctype and charset in the document content
vld.validate("http://datetostr.org")

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

Running tests.
python -m unittest discover

Metadata

Release files for py_w3c 0.1.2

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

Source distribution (sdist)

Source distribution for py_w3c 0.1.2
File Size Uploaded
py_w3c-0.1.2.tar.gz 6.2 kB Details

Release files / py_w3c-0.1.2.tar.gz

Download URL py_w3c-0.1.2.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ccea0bdc9d955619379791246c7452277e7b3a165b085958c80af49f5e4d20f5
BLAKE2b-256 checksum
How to use checksums
7e8ccfad557682aaeda8fa374d61c7e5cad59792885c92195c7bd7e007e6db92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.3.1

1 release file

0.2.0

1 release file

This release

0.1.2 This release

1 release file

0.1.1

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