mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 12:59:42 -07:00
Fix parsing request responst message
This commit is contained in:
parent
70c0f912e2
commit
0272c35047
1 changed files with 11 additions and 11 deletions
|
@ -295,15 +295,15 @@ def server_message(response, return_msg=False):
|
||||||
try:
|
try:
|
||||||
soup = BeautifulSoup(response.content, "html5lib")
|
soup = BeautifulSoup(response.content, "html5lib")
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
soup = None
|
||||||
|
|
||||||
|
if soup:
|
||||||
# Find body and cleanup common tags to grab content, which probably
|
# Find body and cleanup common tags to grab content, which probably
|
||||||
# contains the message.
|
# contains the message.
|
||||||
message = soup.find("body")
|
message = soup.find("body")
|
||||||
elements = ("header", "script", "footer", "nav", "input", "textarea")
|
elements = ("header", "script", "footer", "nav", "input", "textarea")
|
||||||
|
|
||||||
for element in elements:
|
for element in elements:
|
||||||
|
|
||||||
for tag in soup.find_all(element):
|
for tag in soup.find_all(element):
|
||||||
tag.replaceWith("")
|
tag.replaceWith("")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue