Skip to content

Commit f33bbf7

Browse files
committed
fix tests to raise non-200 status code messages
import
1 parent 3a19700 commit f33bbf7

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

astroquery/esa/euclid/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,6 @@ def get_status_messages(self, verbose=False):
776776
sub_context = self.EUCLID_MESSAGES
777777
conn_handler = self._TapPlus__getconnhandler()
778778
response = conn_handler.execute_tapget(sub_context, verbose=verbose)
779-
response.raise_for_status()
780779
if response.status == 200:
781780
if isinstance(response, Iterable):
782781
for line in response:
@@ -787,6 +786,8 @@ def get_status_messages(self, verbose=False):
787786
print(e)
788787
except IndexError:
789788
print("Archive down for maintenance")
789+
else:
790+
raise HTTPError(f"Failed to retrieve status messages. HTTP status code: {response.status}")
790791

791792
@staticmethod
792793
def __set_dirs(output_file, observation_id):

astroquery/esa/jwst/core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import zipfile
1818
from datetime import datetime, timezone
1919
from urllib.parse import urlencode
20+
from requests.exceptions import HTTPError
2021

2122
import astroquery.esa.utils.utils as esautils
2223

@@ -697,11 +698,12 @@ def get_status_messages(self):
697698
subContext = conf.JWST_MESSAGES
698699
connHandler = self.__jwsttap._TapPlus__getconnhandler()
699700
response = connHandler.execute_tapget(subContext, verbose=False)
700-
response.raise_for_status()
701701
if response.status == 200:
702702
for line in response:
703703
string_message = line.decode("utf-8")
704704
print(string_message[string_message.index('=') + 1:])
705+
else:
706+
raise HTTPError(f"Failed to retrieve status messages. HTTP status code: {response.status}")
705707

706708
def get_product_list(self, *, observation_id=None,
707709
cal_level="ALL",

astroquery/gaia/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,6 @@ def get_status_messages(self):
12051205
sub_context = self.GAIA_MESSAGES
12061206
conn_handler = self._TapPlus__getconnhandler()
12071207
response = conn_handler.execute_tapget(sub_context, verbose=False)
1208-
response.raise_for_status()
12091208
if response.status == 200:
12101209
if isinstance(response, Iterable):
12111210
for line in response:
@@ -1216,6 +1215,8 @@ def get_status_messages(self):
12161215
print(e)
12171216
except IndexError:
12181217
print("Archive down for maintenance")
1218+
else:
1219+
raise HTTPError(f"Failed to retrieve status messages. HTTP status code: {response.status}")
12191220

12201221

12211222
Gaia = GaiaClass(show_server_messages=False)

0 commit comments

Comments
 (0)