mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 21:21:15 -07:00
Update plexapi==4.17.0
This commit is contained in:
parent
3cb71f94a3
commit
f6bffe1850
32 changed files with 1224 additions and 966 deletions
|
@ -17,12 +17,12 @@ from getpass import getpass
|
|||
from hashlib import sha1
|
||||
from threading import Event, Thread
|
||||
from urllib.parse import quote
|
||||
from xml.etree import ElementTree
|
||||
|
||||
import requests
|
||||
from requests.status_codes import _codes as codes
|
||||
|
||||
from plexapi.exceptions import BadRequest, NotFound, Unauthorized
|
||||
|
||||
try:
|
||||
from tqdm import tqdm
|
||||
except ImportError:
|
||||
|
@ -718,3 +718,14 @@ _illegal_XML_re = re.compile(fr'[{"".join(_illegal_XML_ranges)}]')
|
|||
|
||||
def cleanXMLString(s):
|
||||
return _illegal_XML_re.sub('', s)
|
||||
|
||||
|
||||
def parseXMLString(s: str):
|
||||
""" Parse an XML string and return an ElementTree object. """
|
||||
if not s.strip():
|
||||
return None
|
||||
try: # Attempt to parse the string as-is without cleaning (which is expensive)
|
||||
return ElementTree.fromstring(s.encode('utf-8'))
|
||||
except ElementTree.ParseError: # If it fails, clean the string and try again
|
||||
cleaned_s = cleanXMLString(s).encode('utf-8')
|
||||
return ElementTree.fromstring(cleaned_s) if cleaned_s.strip() else None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue