Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
snbianco committed Jan 23, 2025
1 parent db9632e commit aab812a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
11 changes: 6 additions & 5 deletions astroquery/mast/missions.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ def mission(self):

@mission.setter
def mission(self, value):
# Need to update the service parameters if the mission is changed
self._mission = value.lower()
# Setter that updates the service parameters if the mission is changed
self._mission = value.lower() # case-insensitive
self._service_api_connection.set_service_params(self.service_dict, f'search/{self.mission}')

def _parse_result(self, response, *, verbose=False): # Used by the async_to_sync decorator functionality
Expand All @@ -100,7 +100,7 @@ def _parse_result(self, response, *, verbose=False): # Used by the async_to_syn
if self.service == self._search:
results = self._service_api_connection._parse_result(response, verbose, data_key='results')
elif self.service == self._list_products:
# Results from list_products endpoint need to be handled differently
# Results from post_list_products endpoint need to be handled differently
results = Table(response.json()['products'])

if len(results) >= self.limit:
Expand Down Expand Up @@ -510,8 +510,9 @@ def download_file(self, uri, *, local_path=None, cache=True, verbose=True):
if err.response.status_code == 401:
no_auth_msg = f'You are not authorized to download from {data_url}.'
if self._authenticated:
no_auth_msg += ('\nPlease check your authentication token. You can generate a new '
'token at https://auth.mast.stsci.edu/token?suggested_name=Astroquery&'
no_auth_msg += ('\nYou do not have access to download this data, or your authentication '
'token may be expired. You can generate a new token at '
'https://auth.mast.stsci.edu/token?suggested_name=Astroquery&'
'suggested_scope=mast:exclusive_access')
else:
no_auth_msg += ('\nPlease authenticate yourself using the `~astroquery.mast.MastMissions.login` '
Expand Down
2 changes: 0 additions & 2 deletions astroquery/mast/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ def __init__(self, session=None):

self.TIMEOUT = conf.timeout

self._column_configs = {} # Dict to hold column configurations for services

def set_service_params(self, service_dict, service_name="", server_prefix=False):
"""
Initialize the request url and available queries for a given service.
Expand Down
2 changes: 1 addition & 1 deletion astroquery/mast/tests/test_mast.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def test_missions_download_no_auth(patch_post, caplog):
assert 'HTTPError' in result[1]
with caplog.at_level('WARNING', logger='astroquery'):
assert 'You are not authorized to download' in caplog.text
assert 'Please check your authentication token' in caplog.text
assert 'You do not have access to download this data' in caplog.text


def test_missions_get_dataset_kwd(patch_post, caplog):
Expand Down

0 comments on commit aab812a

Please sign in to comment.