overpass-api-python-wrapper
overpass-api-python-wrapper copied to clipboard
Returned XML is parsed as JSON
Seems to happen at api.py#87.
import overpass
api = overpass.API(debug=True, timeout=250)
query = "<query>"
response = api.get(query, responseformat="xml", verbosity="meta")
print(response)
Traceback (most recent call last):
File "overpass_script.py", line 4, in <module>
response = api.get(query, responseformat="xml", verbosity="meta")
File "/usr/local/lib/python3.5/dist-packages/overpass/api.py", line 80, in get
response = json.loads(r.text)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column
With a very simple query, it works using Python 3. Can you add the exact query and Python version you are using?
Closing because no more feedback for some time. Feel free to re-open @rivermont if you are having the same problem still.
Wait a minute.. There is something specific to string encoding here.. It would really help to get the specific query that gave you this problem @rivermont -- thanks!