Skip to content

Commit

Permalink
MNT: Fix unicode issues on Python 2.7
Browse files Browse the repository at this point in the history
Pass the raw response content, rather than decoded text, to the element
tree parser. This allows the parser to detect the encoding using the
standard xml tags.
  • Loading branch information
dopplershift committed Nov 1, 2017
1 parent 39029b0 commit fd60234
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion siphon/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def __init__(self, catalog_url):
resp.raise_for_status()

# begin parsing the xml doc
root = ET.fromstring(resp.text)
root = ET.fromstring(resp.content)
self.catalog_name = root.attrib.get('name', 'No name found')

self.datasets = DatasetCollection()
Expand Down
2 changes: 1 addition & 1 deletion siphon/radarserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def _get_metadata(self):

def _get_stations(self, station_file='stations.xml'):
resp = self.get_path(station_file)
self.stations = parse_station_table(ET.fromstring(resp.text))
self.stations = parse_station_table(ET.fromstring(resp.content))

def query(self):
"""Return a new query for the radar server.
Expand Down

0 comments on commit fd60234

Please sign in to comment.