Assume no illegal XML and no more skipping broken Last.fm

This commit is contained in:
hugovk 2017-10-20 00:51:34 +03:00
parent b55b40c3fe
commit b559495366
4 changed files with 0 additions and 35 deletions

View file

@ -22,7 +22,6 @@
from xml.dom import minidom, Node
import collections
import re
import hashlib
import shelve
import six
@ -108,18 +107,6 @@ SCROBBLE_MODE_LOVED = "L"
SCROBBLE_MODE_BANNED = "B"
SCROBBLE_MODE_SKIPPED = "S"
# From http://boodebr.org/main/python/all-about-python-and-unicode#UNI_XML
RE_XML_ILLEGAL = (u'([\u0000-\u0008\u000b-\u000c\u000e-\u001f\ufffe-\uffff])' +
u'|' +
u'([%s-%s][^%s-%s])|([^%s-%s][%s-%s])|([%s-%s]$)|(^[%s-%s])'
%
(unichr(0xd800), unichr(0xdbff), unichr(0xdc00),
unichr(0xdfff), unichr(0xd800), unichr(0xdbff),
unichr(0xdc00), unichr(0xdfff), unichr(0xd800),
unichr(0xdbff), unichr(0xdc00), unichr(0xdfff)))
XML_ILLEGAL = re.compile(RE_XML_ILLEGAL)
# Python >3.4 and >2.7.9 has sane defaults
SSL_CONTEXT = ssl.create_default_context()
@ -862,8 +849,6 @@ class _Request(object):
except Exception as e:
raise MalformedResponseError(self.network, e)
response_text = XML_ILLEGAL.sub("?", response_text)
self._check_response_for_errors(response_text)
conn.close()
return response_text