Compare commits
No commits in common. "f83a4b143006577d9434633dd43f2917a6e51307" and "917aa0fbc5078e2ed89c2114937ee5290ab184fe" have entirely different histories.
f83a4b1430
...
917aa0fbc5
|
@ -19,13 +19,19 @@ import re
|
|||
|
||||
import lxml.etree
|
||||
import lxml.html
|
||||
import lxml.html.soupparser
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
|
||||
def parse(data, encoding=None):
|
||||
kwargs = {'from_encoding': encoding} if encoding else {}
|
||||
return lxml.html.soupparser.fromstring(data, **kwargs)
|
||||
if encoding:
|
||||
data = BeautifulSoup(data, 'lxml', from_encoding=encoding).prettify('utf-8')
|
||||
|
||||
else:
|
||||
data = BeautifulSoup(data, 'lxml').prettify('utf-8')
|
||||
|
||||
parser = lxml.html.HTMLParser(remove_comments=True, encoding='utf-8')
|
||||
|
||||
return lxml.html.fromstring(data, parser=parser)
|
||||
|
||||
|
||||
def count_words(string):
|
||||
|
|
|
@ -277,7 +277,7 @@ def cgi_handle_request():
|
|||
|
||||
class WSGIRequestHandlerRequestUri(wsgiref.simple_server.WSGIRequestHandler):
|
||||
def get_environ(self):
|
||||
env = wsgiref.simple_server.WSGIRequestHandler.get_environ(self)
|
||||
env = super().get_environ()
|
||||
env['REQUEST_URI'] = self.path
|
||||
return env
|
||||
|
||||
|
|
Loading…
Reference in New Issue