Skip to content

Commit 4e91895

Browse files
committed
many minor fixes:
* ALMA cannot use beta server any more * incorrect variable used in one ALMA test * more verbose error reporting for commons.send_request (even though this is meant to be replaced) * raise for status instead of trying to parse things after server errors in nasa_ads
1 parent 80a5ef9 commit 4e91895

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

astroquery/alma/tests/test_alma_remote.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333
class TestAlma:
3434

3535
def setup_class(cls):
36-
Alma.archive_url = 'http://beta.cadc-ccda.hia-iha.nrc-cnrc.gc.ca'
36+
pass
37+
# starting somewhere between Nov 2015 and Jan 2016, the beta server
38+
# stopped serving the actual data, making all staging attempts break
39+
#Alma.archive_url = 'http://beta.cadc-ccda.hia-iha.nrc-cnrc.gc.ca'
3740

3841
@pytest.fixture()
3942
def temp_dir(self, request):
@@ -68,7 +71,7 @@ def test_m83(self, temp_dir):
6871

6972
m83_data = alma.query_object('M83')
7073
uids = np.unique(m83_data['Member ous id'])
71-
link_list = Alma.stage_data(uids)
74+
link_list = alma.stage_data(uids)
7275

7376
def test_stage_data(self, temp_dir):
7477
alma = Alma()

astroquery/nasa_ads/core.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ def query_simple(self, query_string, get_query_payload=False,
4848
data=request_payload, timeout=self.TIMEOUT,
4949
cache=cache)
5050

51+
response.raise_for_status()
52+
5153
# primarily for debug purposes, but also useful if you want to send
5254
# someone a URL linking directly to the data
5355
if get_query_payload:

astroquery/utils/commons.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ def send_request(url, data, timeout, request_type='POST', headers={},
103103
except requests.exceptions.Timeout:
104104
raise TimeoutError("Query timed out, time elapsed {time}s".
105105
format(time=timeout))
106-
except requests.exceptions.RequestException:
107-
raise Exception("Query failed\n")
106+
except requests.exceptions.RequestException as ex:
107+
raise Exception("Query failed: {0}\n".format(ex))
108108

109109

110110
def parse_radius(radius):

0 commit comments

Comments
 (0)