Update library: html5lib

This commit is contained in:
Ruud
2014-01-20 16:50:21 +01:00
parent 04539edb45
commit f318524070
6 changed files with 8 additions and 7 deletions
+6 -1
View File
@@ -1,5 +1,6 @@
from __future__ import absolute_import, division, unicode_literals
from six import text_type
from six.moves import http_client
import codecs
import re
@@ -118,7 +119,11 @@ class BufferedStream(object):
def HTMLInputStream(source, encoding=None, parseMeta=True, chardet=True):
if hasattr(source, "read"):
if isinstance(source, http_client.HTTPResponse):
# Work around Python bug #20007: read(0) closes the connection.
# http://bugs.python.org/issue20007
isUnicode = False
elif hasattr(source, "read"):
isUnicode = isinstance(source.read(0), text_type)
else:
isUnicode = isinstance(source, text_type)