Skip to content

Returned XML is parsed as JSON #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
rivermont opened this issue May 8, 2018 · 3 comments
Open

Returned XML is parsed as JSON #96

rivermont opened this issue May 8, 2018 · 3 comments
Milestone

Comments

@rivermont
Copy link

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
@mvexel
Copy link
Owner

mvexel commented Sep 5, 2018

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

@mvexel
Copy link
Owner

mvexel commented Sep 13, 2018

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

@mvexel mvexel closed this as completed Sep 13, 2018
@mvexel mvexel reopened this Sep 13, 2018
@mvexel
Copy link
Owner

mvexel commented Sep 13, 2018

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants