overpass-api-python-wrapper icon indicating copy to clipboard operation
overpass-api-python-wrapper copied to clipboard

Returned XML is parsed as JSON

Open rivermont opened this issue 6 years ago • 3 comments

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

rivermont avatar May 08 '18 16:05 rivermont

With a very simple query, it works using Python 3. Can you add the exact query and Python version you are using?

mvexel avatar Sep 05 '18 15:09 mvexel

Closing because no more feedback for some time. Feel free to re-open @rivermont if you are having the same problem still.

mvexel avatar Sep 13 '18 21:09 mvexel

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!

mvexel avatar Sep 13 '18 21:09 mvexel