fermi: migrate from LATDataQuery.cgi scraping to the new REST API - #3647
Draft
PazSheimy wants to merge 7 commits into
Draft
fermi: migrate from LATDataQuery.cgi scraping to the new REST API#3647PazSheimy wants to merge 7 commits into
PazSheimy wants to merge 7 commits into
Conversation
added 7 commits
July 17, 2026 16:08
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3647 +/- ##
==========================================
+ Coverage 73.17% 73.45% +0.28%
==========================================
Files 227 230 +3
Lines 21078 21426 +348
==========================================
+ Hits 15423 15739 +316
- Misses 5655 5687 +32 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3646
Closes #1849
Background
The Fermi LAT data server is replacing the LATDataQuery.cgi form endpoint
with a JSON REST API. Both will run in parallel for some time, but the REST
API will eventually replace LATDataQuery.cgi entirely, so this PR migrates
the module in advance for astroquery users.
https://fermi.gsfc.nasa.gov/ssc/data/access/lat/query/api/v1(docs). I work on the
Fermi data-server side and wrote this migration against the new API.
What changed
query_object_async()POSTs a JSON payload to{base}/queryand returnsthe server-assigned
query_id. Previously it returned the URL of an HTMLresults page
_parse_result()polls{base}/query/{id}/statusand reads{base}/query/{id}/results, so the synchronousquery_object()keeps its exact previous signature and return type(a list of FITS file URLs) — existing user scripts are unaffected.
requestsusage (everything now goes throughBaseQuery._request).get_status(),list_results(),wait_for_completion()(with optionalmax_wait), andget_file_urls().zenithangle,coordsystem(J2000/B1950/Galactic- previously only J2000), and all-sky queries(radius > 60 deg with an observation window <= 24 h); literal
"RA,Dec"strings bypass name resolution.
RemoteServiceError;a query that never completes can be bounded with
max_wait(raises
TimeoutError).a JSON body like
{"error": "Invalid energy range ..."}is raised as aRemoteServiceErrorcarrying that message (closes the old TODO from Fail with useful failure messages on genuine failures. #1849).GetFermilatDatafile/get_fermilat_datafilekept as deprecated shimsdelegating to
get_file_urls().standard astroquery async/sync pattern.
docs/fermi/fermi.rst) and changelog updated.Testing
running/complete/failed, results), including payload-shape tests, error
paths, and a forward-compatibility test for absolute file URLs:
15 pass offline.
4/4 pass (basic query, async + status, zenith angle, all-sky).