diff --git a/requests_html.py b/requests_html.py index 80a8142..6939357 100644 --- a/requests_html.py +++ b/requests_html.py @@ -11,7 +11,7 @@ from pyquery import PyQuery from fake_useragent import UserAgent from lxml import etree from lxml.html import HtmlElement -from lxml.html.soupparser import fromstring +from lxml.html.soupparser import fromstring as soup_parse from parse import search as parse_search from parse import findall, Result from w3lib.encoding import html_to_unicode @@ -101,6 +101,10 @@ class BaseParser: return self._encoding if self._encoding else self.default_encoding + @encoding.setter + def encoding(self, enc): + self._encoding = enc + @property def pq(self) -> PyQuery: """`PyQuery `_ representation @@ -113,7 +117,7 @@ class BaseParser: """`lxml `_ representation of the :class:`Element ` or :class:`HTML `. """ - return fromstring(self.html) + return soup_parse(self.html) @property def text(self) -> _Text: diff --git a/setup.py b/setup.py index b28f984..9c4900a 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ DESCRIPTION = 'HTML Parsing for Humans.' URL = 'https://github.com/kennethreitz/requests-html' EMAIL = 'me@kennethreitz.org' AUTHOR = 'Kenneth Reitz' -VERSION = '0.6.8' +VERSION = '0.6.9' # What packages are required for this module to be executed? REQUIRED = [