forked from openlp/openlp
Fix some BeautifulSoup warnings about parsers.
This commit is contained in:
parent
8fbd431bed
commit
734bf4ffc4
@ -288,7 +288,7 @@ class BGExtract(RegistryProperties):
|
|||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
page_source = str(page_source, 'cp1251')
|
page_source = str(page_source, 'cp1251')
|
||||||
try:
|
try:
|
||||||
soup = BeautifulSoup(page_source)
|
soup = BeautifulSoup(page_source, 'lxml')
|
||||||
except Exception:
|
except Exception:
|
||||||
log.error('BeautifulSoup could not parse the Bible page.')
|
log.error('BeautifulSoup could not parse the Bible page.')
|
||||||
send_error_message('parse')
|
send_error_message('parse')
|
||||||
@ -759,7 +759,7 @@ def get_soup_for_bible_ref(reference_url, header=None, pre_parse_regex=None, pre
|
|||||||
page_source = re.sub(pre_parse_regex, pre_parse_substitute, page_source.decode())
|
page_source = re.sub(pre_parse_regex, pre_parse_substitute, page_source.decode())
|
||||||
soup = None
|
soup = None
|
||||||
try:
|
try:
|
||||||
soup = BeautifulSoup(page_source)
|
soup = BeautifulSoup(page_source, 'lxml')
|
||||||
CLEANER_REGEX.sub('', str(soup))
|
CLEANER_REGEX.sub('', str(soup))
|
||||||
except Exception:
|
except Exception:
|
||||||
log.exception('BeautifulSoup could not parse the bible page.')
|
log.exception('BeautifulSoup could not parse the bible page.')
|
||||||
|
@ -152,7 +152,7 @@ class TestBSExtract(TestCase):
|
|||||||
self.test_html = '<ul><li><a href="/overlay/selectChapter?tocBook=1">Genesis</a></li>' \
|
self.test_html = '<ul><li><a href="/overlay/selectChapter?tocBook=1">Genesis</a></li>' \
|
||||||
'<li><a href="/overlay/selectChapter?tocBook=2"></a></li>' \
|
'<li><a href="/overlay/selectChapter?tocBook=2"></a></li>' \
|
||||||
'<li><a href="/overlay/selectChapter?tocBook=3">Leviticus</a></li></ul>'
|
'<li><a href="/overlay/selectChapter?tocBook=3">Leviticus</a></li></ul>'
|
||||||
self.test_soup = BeautifulSoup(self.test_html)
|
self.test_soup = BeautifulSoup(self.test_html, 'lxml')
|
||||||
instance = BSExtract()
|
instance = BSExtract()
|
||||||
self.mock_log.reset_mock()
|
self.mock_log.reset_mock()
|
||||||
self.mock_urllib.reset_mock()
|
self.mock_urllib.reset_mock()
|
||||||
|
Loading…
Reference in New Issue
Block a user