Skip to content

Commit 3cbd794

Browse files
committed
remove try/except clauses in more show messages, and set show_messages to false by default at import time
1 parent 435d5b8 commit 3cbd794

File tree

3 files changed

+33
-38
lines changed

3 files changed

+33
-38
lines changed

astroquery/esa/euclid/core.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -754,23 +754,20 @@ def get_status_messages(self, verbose=False):
754754
flag to display information about the process
755755
756756
"""
757-
try:
758-
sub_context = self.EUCLID_MESSAGES
759-
conn_handler = self._TapPlus__getconnhandler()
760-
response = conn_handler.execute_tapget(sub_context, verbose=verbose)
761-
if response.status == 200:
762-
if isinstance(response, Iterable):
763-
for line in response:
764-
765-
try:
766-
print(line.decode("utf-8").split('=', 1)[1])
767-
except ValueError as e:
768-
print(e)
769-
except IndexError:
770-
print("Archive down for maintenance")
771-
772-
except OSError:
773-
print("Status messages could not be retrieved")
757+
sub_context = self.EUCLID_MESSAGES
758+
conn_handler = self._TapPlus__getconnhandler()
759+
response = conn_handler.execute_tapget(sub_context, verbose=verbose)
760+
if response.status == 200:
761+
if isinstance(response, Iterable):
762+
for line in response:
763+
764+
try:
765+
print(line.decode("utf-8").split('=', 1)[1])
766+
except ValueError as e:
767+
print(e)
768+
except IndexError:
769+
print("Archive down for maintenance")
770+
774771

775772
@staticmethod
776773
def __set_dirs(output_file, observation_id):
@@ -1601,4 +1598,4 @@ def get_scientific_product_list(self, *, observation_id=None, tile_index=None, c
16011598
return job.get_results()
16021599

16031600

1604-
Euclid = EuclidClass()
1601+
Euclid = EuclidClass(show_server_messages=False)

astroquery/esa/hubble/core.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -922,15 +922,13 @@ def get_status_messages(self):
922922
the status of eHST TAP
923923
"""
924924

925-
try:
926-
esautils.execute_servlet_request(
927-
url=conf.EHST_TAP_SERVER + "/" + conf.EHST_MESSAGES,
928-
tap=self.tap,
929-
query_params={},
930-
parser_method=self.parse_messages_response
931-
)
932-
except OSError:
933-
print("Status messages could not be retrieved")
925+
subContext = conf.EHST_MESSAGES
926+
connHandler = self._tap._TapPlus__getconnhandler()
927+
response = connHandler.execute_tapget(subContext, verbose=False)
928+
if response.status == 200:
929+
for line in response:
930+
string_message = line.decode("utf-8")
931+
print(string_message[string_message.index('=') + 1:])
934932

935933
def parse_messages_response(self, response):
936934
string_messages = []
@@ -1051,5 +1049,8 @@ def get_datalabs_path(self, filename, default_volume=None):
10511049
return full_path
10521050

10531051

1052+
<<<<<<< HEAD
10541053
# Need to be False in order to avoid reaching out to the remote server at import time
1054+
=======
1055+
>>>>>>> d99705881... remove try/except clauses in more show messages, and set show_messages to false by default at import time
10551056
ESAHubble = ESAHubbleClass(show_messages=False)

astroquery/esa/jwst/core.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -694,16 +694,13 @@ def get_status_messages(self):
694694
the status of JWST TAP
695695
"""
696696

697-
try:
698-
subContext = conf.JWST_MESSAGES
699-
connHandler = self.__jwsttap._TapPlus__getconnhandler()
700-
response = connHandler.execute_tapget(subContext, verbose=False)
701-
if response.status == 200:
702-
for line in response:
703-
string_message = line.decode("utf-8")
704-
print(string_message[string_message.index('=') + 1:])
705-
except OSError:
706-
print("Status messages could not be retrieved")
697+
subContext = conf.JWST_MESSAGES
698+
connHandler = self.__jwsttap._TapPlus__getconnhandler()
699+
response = connHandler.execute_tapget(subContext, verbose=False)
700+
if response.status == 200:
701+
for line in response:
702+
string_message = line.decode("utf-8")
703+
print(string_message[string_message.index('=') + 1:])
707704

708705
def get_product_list(self, *, observation_id=None,
709706
cal_level="ALL",
@@ -1275,4 +1272,4 @@ def get_decoded_string(str):
12751272
return str
12761273

12771274

1278-
Jwst = JwstClass()
1275+
Jwst = JwstClass(show_messages=False)

0 commit comments

Comments
 (0)