let's see if this fixes things

Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
This commit is contained in:
2018-02-26 19:35:38 -05:00
parent 0a78608fed
commit cea3990b6f
2 changed files with 3 additions and 4 deletions
+2 -2
View File
@@ -50,7 +50,7 @@ class BaseParser:
return self._encoding
# Scan meta tags for chaset.
self._encoding = html_to_unicode(self.default_encoding, self.html)[0]
self._encoding = html_to_unicode(self.default_encoding, self.html.encode(DEFAULT_ENCODING))[0]
return self._encoding if self._encoding else self.default_encoding
@@ -241,7 +241,7 @@ class Session(requests.Session):
if not response.encoding:
response.encoding = DEFAULT_ENCODING
response.html = HTML(url=response.url, html=response.text, default_encoding=response.encoding)
response.html = HTML(url=response.url, html=response.content, default_encoding=response.encoding)
return response
+1 -2
View File
@@ -59,7 +59,6 @@ def test_xpath():
html = r.html.xpath('/html', first=True)
assert 'no-js' in html.attrs['class']
if __name__ == '__main__':
# test_file_get()
test_css_selector()