* move html_checker.py * move stringify.py * move tests into module * remove duplicate progress.py * fix module imports
15 lines
313 B
Python
15 lines
313 B
Python
from lxml import etree
|
|
|
|
def check_html(html):
|
|
'''
|
|
Check whether the passed in html string can be parsed by lxml.
|
|
Return bool success.
|
|
'''
|
|
parser = etree.HTMLParser()
|
|
try:
|
|
etree.fromstring(html, parser)
|
|
return True
|
|
except Exception as err:
|
|
pass
|
|
return False
|