Using WCAG-Zoo validators in pythonΒΆ

As WCAG-Zoo is a native Python 3 library, it can be imported and used in Python 3 scripts easily.

Once installed from pip (pip install wcag_zoo), load any of the validators and call validate_document on an instance as shown in the example below.

#!/usr/bin/env python3
from wcag_zoo.validators.tarsier import Tarsier

my_html = b"<html><head><body><h1>1</h1><h3>This is wrong, it should be h2"
instance = Tarsier()
results = instance.validate_document(my_html)

print("/no/tmp/dir", len(results['failures']), "failures")