]> git.phdru.name Git - m_lib.git/blobdiff - m_lib/net/www/html.py
Fix for Python 3: import html.parser and html.entities
[m_lib.git] / m_lib / net / www / html.py
index 723f0c0a4ff8d4c02820bd5ca1652de520c72ec8..c5d9d03e6d7f76fef40c47a895b38051a653edc4 100644 (file)
@@ -1,8 +1,12 @@
 """HTML parsers"""
 
 
-from HTMLParser import HTMLParser as _HTMLParser
-from htmlentitydefs import entitydefs
+try:
+    from html.parser import HTMLParser as _HTMLParser
+    from html.entities import entitydefs
+except ImportError:
+    from HTMLParser import HTMLParser as _HTMLParser
+    from htmlentitydefs import entitydefs
 
 
 def join_attrs(attrs):