Suppress BeautifulSoup warning

by explicitly passing in the default parser as recommended by the error message:

```
/home/challberg/.local/lib/python2.7/site-packages/bs4/__init__.py:181: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html.parser"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

The code that caused this warning is on line 35 of the file unroll.py. To get rid of this warning, change code that looks like this:

 BeautifulSoup(YOUR_MARKUP})

to this:

 BeautifulSoup(YOUR_MARKUP, "html.parser")

  markup_type=markup_type))
```
This commit is contained in:
Chris Hallberg
2017-06-12 16:03:04 -04:00
committed by GitHub
parent 53ba0daa77
commit 8696e2bde1

View File

@@ -52,7 +52,7 @@ class MarkdownConverter(object):
# want a full document. Therefore, we'll mark our fragment with an id,
# create the document, and extract the element with the id.
html = wrapped % html
soup = BeautifulSoup(html)
soup = BeautifulSoup(html, 'html.parser')
return self.process_tag(soup.find(id=FRAGMENT_ID), children_only=True)
def process_tag(self, node, children_only=False):