Skip to content
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

GAIA fix the method read_http_response to retrieve json files recently included in #2970 #2990

Conversation

cosmoJFH
Copy link
Contributor

In #2970 the method read_http_response was updated to handle json files. The changes were included in astroquery 0.4.7, but we have reported that this functionality is not working as expected:

import astroquery as astroquery
print(astroquery.__version__)
from astroquery.gaia import Gaia
table=Gaia.launch_job("select top 10 * from gaiadr3.gaia_source order by source_id", output_format="json",dump_to_file=False)
print(table)

0.4.8.dev9251
Traceback (most recent call last):
  File "/home/xxx/repos/astroquery/astroquery/gaia/tests/validate1308.py", line 11, in <module>
    table=Gaia.launch_job("select top 10 * from gaiadr3.gaia_source order by source_id", output_format="json",dump_to_file=False)
  File "/home/xxx/.local/lib/python3.10/site-packages/astroquery/gaia/core.py", line 971, in launch_job
    return TapPlus.launch_job(self, query=query, name=name,
  File "/home/xxx/.local/lib/python3.10/site-packages/astroquery/utils/tap/core.py", line 360, in launch_job
    results = utils.read_http_response(response, output_format)
  File "/home/xxx/.local/lib/python3.10/site-packages/astroquery/utils/tap/xmlparser/utils.py", line 43, in read_http_response
    data = json.load(response)
  File "/usr/lib/python3.10/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

A fix to this issue is included in this PR.
A new test has been included too.

cc @esdc-esac-esa-int

jira: GAIAPCR-1308

Copy link
Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cosmoJFH.

The changes look good to me, but I cannot run example in the description as the server currently times out. Anyway, tests pass, so this is good to go now.

@bsipocz bsipocz added this to the v0.4.8 milestone Apr 19, 2024
@bsipocz bsipocz merged commit 8777126 into astropy:main Apr 19, 2024
9 checks passed
@cosmoJFH
Copy link
Contributor Author

Hi @bsipocz, the gaia archive will be out of service until the 23rd of April.

@bsipocz
Copy link
Member

bsipocz commented Apr 19, 2024

Ahh, that rings a bell that I saw something about it. But I wonder why it doesn't come up as a status message from the server? Or we just do that with the other ESA modules?

@cosmoJFH
Copy link
Contributor Author

Ahh, that rings a bell that I saw something about it. But I wonder why it doesn't come up as a status message from the server? Or we just do that with the other ESA modules?

In this occasion all the servers at ESAC are down, so no redirection is carried out. I mean, all the servers have been turned off. This would affect all the projects running at ESAC.

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

Successfully merging this pull request may close these issues.

2 participants