From 8696e2bde18f626e380feac723af15648169a71d Mon Sep 17 00:00:00 2001 From: Chris Hallberg Date: Mon, 12 Jun 2017 16:03:04 -0400 Subject: [PATCH] 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)) ``` --- markdownify/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markdownify/__init__.py b/markdownify/__init__.py index 9b44d47..b265cab 100644 --- a/markdownify/__init__.py +++ b/markdownify/__init__.py @@ -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):