Skip to content

Commit 6b494af

Browse files
committed
Fixed issue #160
1 parent ea95f09 commit 6b494af

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

‎grab/document.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import codecs
1717
from datetime import datetime
1818
import time
19+
from lxml.html import HTMLParser
20+
from lxml.etree import XMLParser, parse, ParserError
1921
from selection import XpathSelector
2022
import six
2123
from six.moves.urllib.parse import urlsplit, parse_qs, urljoin
@@ -288,9 +290,6 @@ def tree(self):
288290
return self.build_html_tree()
289291

290292
def _build_dom(self, content, mode):
291-
from lxml.html import HTMLParser
292-
from lxml.etree import XMLParser, parse
293-
294293
assert mode in ('html', 'xml')
295294
if mode == 'html':
296295
if not hasattr(THREAD_STORAGE, 'html_parser'):
@@ -307,8 +306,6 @@ def _build_dom(self, content, mode):
307306

308307

309308
def build_html_tree(self):
310-
from lxml.etree import ParserError
311-
312309
from grab.base import GLOBAL_STATE
313310

314311
if self._lxml_tree is None:

0 commit comments

Comments
 (0)