astropy / astropy/astroquery

BUG: HSA raise the correct error rather than LoginError

Open
#3,005 3 comments 0 reactions 0 assignees View on GitHub
bug esa.hsa
Dominant language
Python
Stars
791
Forks
451
Avg merge
1d 3h
Merged PRs (30d)
4

Description

I am trying to search the herschel archive for multiple sources (I'll wait to hit it with 1000's, but am testing now with 10). I am seeing a strange "LoginError: Data protected by proprietary rights. Please check your credentials".
1. I can't imagine that there is herschel proprietary data still, given that the telescope hasn't taken data in years, so I am guessing something else is going on, but have sent a herschel helpdesk message to see if I can't get a definitive answer on that.
2. I tried a "try except" around the call to say don't grab those observation_id that appear to be proprietary, but python won't let me do an
` except LoginError`. It tells me "NameError: name 'LoginError' is not defined". (and I tried, but it doesn't work to 'except NameError')

Is it possible for astroquery to throw some other, recognizable error, so I can move around this problem? I'll take other suggested workarounds!

Thanks,

minimum example, using the coords and syntax for query_hsa_tap that are listed in the astroquery readthedocs page (https://astroquery.readthedocs.io/en/latest/esa/hsa/hsa.html):

```
from astroquery.esa.hsa import HSA

test_table = HSA.query_hsa_tap("select top 10 observation_id from hsa.v_active_observation where "
"contains(point('ICRS', hsa.v_active_observation.ra, hsa.v_active_observation.dec), "
"circle('ICRS', 100.2417,9.895, 1.1))=1")

for row in test_table:
print(str(row['observation_id']) ) #confirm that syntax is not the problem
try:
HSA.download_data(observation_id=str(row['observation_id']), retrieval_type='OBSERVATION',
instrument_name='PACS', download_dir = 'data/herschel')
except LoginError:
#there is some problem here with the observation_id which causes Herschel to think it is proprietary
#we just won't get this data, move on to the next observation
print("loginerror")
```

Contributor guide

Open the contributing guide

Research direction

Start with the HSA.query_hsa_tap and HSA.download_data entry points and reproduce the minimum example against the Herschel archive. Trace how the proprietary-data response becomes LoginError and identify a recognizable exception callers can catch. Done means the failure raises the intended exception for affected observations without changing successful downloads.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.