mirror of
https://github.com/kennethreitz/requests-html.git
synced 2026-06-05 23:00:20 +00:00
let's see if this fixes things
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
This commit is contained in:
+2
-2
@@ -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
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user