I'm trying to parse a KML service using the following:
import requests
import responses
import xml.etree.ElementTree as ET
response = requests.get('http://206.74.144.42/eitms/roadconditions/')
data = str(response.content)
tree = ET.fromstring(data)
but it keeps telling me that the XML is 'not well formed' like so:
not well-formed (invalid token): line 1, column 1
what does this mean and how do I fix it? Using Python 3.6.
Call fromstring(response.content)
directly, without converting it with str()
.