Don't set parser.encoding

Read-only property with new Beautiful Soup parser.
This commit is contained in:
Chris Mayo 2019-10-05 19:38:57 +01:00
parent 69d426b36f
commit 4f8c2954cf
3 changed files with 1 additions and 6 deletions

View file

@ -84,8 +84,6 @@ class HttpUrl (internpaturl.InternPatternUrl, proxysupport.ProxySupport):
handler = linkparse.MetaRobotsFinder()
parser = htmlsax.parser(handler)
handler.parser = parser
if self.charset:
parser.encoding = self.charset
# parse
try:
parser.feed(self.get_raw_content())

View file

@ -89,14 +89,13 @@ class FormFinder(object):
self.form = None
def search_form(content, cgiuser, cgipassword, encoding='utf-8'):
def search_form(content, cgiuser, cgipassword):
"""Search for a HTML form in the given HTML content that has the given
CGI fields. If no form is found return None.
"""
handler = FormFinder()
parser = htmlsax.parser(handler)
handler.parser = parser
parser.encoding = encoding
# parse
parser.feed(content)
parser.flush()

View file

@ -125,8 +125,6 @@ def find_links (url_data, callback, tags):
# construct parser object
handler = linkparse.LinkFinder(callback, tags)
parser = htmlsax.parser(handler)
if url_data.charset:
parser.encoding = url_data.charset
handler.parser = parser
# parse
try: