"""
Classes wrapping HTTP responses from the Nominatim API.
"""
-from collections import OrderedDict
import re
import json
import xml.etree.ElementTree as ET
else:
code = m.group(2)
self.header['json_func'] = m.group(1)
- self.result = json.JSONDecoder(object_pairs_hook=OrderedDict).decode(code)
- if isinstance(self.result, OrderedDict):
+ self.result = json.JSONDecoder().decode(code)
+ if isinstance(self.result, dict):
if 'error' in self.result:
self.result = []
else:
elif value.startswith("^"):
assert re.fullmatch(value, self.result[idx][field]), \
BadRowValueAssert(self, idx, field, value)
- elif isinstance(self.result[idx][field], OrderedDict):
+ elif isinstance(self.result[idx][field], dict):
assert self.result[idx][field] == eval('{' + value + '}'), \
BadRowValueAssert(self, idx, field, value)
else:
field = self.result[idx]
for p in path:
- assert isinstance(field, OrderedDict)
+ assert isinstance(field, dict)
assert p in field
field = field[p]
assert Almost(value) == float(field)
elif value.startswith("^"):
assert re.fullmatch(value, field)
- elif isinstance(field, OrderedDict):
+ elif isinstance(field, dict):
assert field, eval('{' + value + '}')
else:
assert str(field) == str(value)