Skip to content

Commit 180fe41

Browse files
authored
Merge pull request #751 from keflavich/xmatch-cache
glade catalogue
2 parents e8ceebd + 325c60f commit 180fe41

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

astroquery/xmatch/core.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from . import conf
99
from ..query import BaseQuery
10-
from ..utils import (commons, url_helpers,
10+
from ..utils import (url_helpers,
1111
prepend_docstr_noreturns, async_to_sync,
1212
)
1313

@@ -17,8 +17,8 @@ class XMatchClass(BaseQuery):
1717
URL = conf.url
1818
TIMEOUT = conf.timeout
1919

20-
def query(self, cat1, cat2, max_distance, colRA1=None,
21-
colDec1=None, colRA2=None, colDec2=None):
20+
def query(self, cat1, cat2, max_distance, colRA1=None, colDec1=None,
21+
colRA2=None, colDec2=None, cache=True):
2222
"""
2323
Query the `CDS cross-match service
2424
<http://cdsxmatch.u-strasbg.fr/xmatch>`_ by finding matches between
@@ -57,14 +57,13 @@ def query(self, cat1, cat2, max_distance, colRA1=None,
5757
table : `~astropy.table.Table`
5858
Query results table
5959
"""
60-
response = self.query_async(
61-
cat1, cat2, max_distance, colRA1, colDec1, colRA2, colDec2)
60+
response = self.query_async(cat1, cat2, max_distance, colRA1, colDec1,
61+
colRA2, colDec2, cache=cache)
6262
return ascii.read(response.text, format='csv')
6363

6464
@prepend_docstr_noreturns("\n" + query.__doc__)
65-
def query_async(
66-
self, cat1, cat2, max_distance, colRA1=None,
67-
colDec1=None, colRA2=None, colDec2=None):
65+
def query_async(self, cat1, cat2, max_distance, colRA1=None, colDec1=None,
66+
colRA2=None, colDec2=None, cache=True):
6867
"""
6968
Returns
7069
-------
@@ -84,8 +83,8 @@ def query_async(
8483
self._prepare_sending_table(1, payload, kwargs, cat1, colRA1, colDec1)
8584
self._prepare_sending_table(2, payload, kwargs, cat2, colRA2, colDec2)
8685

87-
response = commons.send_request(
88-
self.URL, payload, self.TIMEOUT, **kwargs)
86+
response = self._request(method='POST', url=self.URL, data=payload,
87+
timeout=self.TIMEOUT, cache=cache, **kwargs)
8988
return response
9089

9190
def _prepare_sending_table(self, i, payload, kwargs, cat, colRA, colDec):
@@ -125,15 +124,17 @@ def is_table_available(self, table_id):
125124
table_id = table_id[7:]
126125
return table_id in self.get_available_tables()
127126

128-
def get_available_tables(self):
127+
def get_available_tables(self, cache=True):
129128
"""Get the list of the VizieR tables which are available in the
130129
xMatch service and return them as a list of strings.
131130
132131
"""
133132
response = self._request(
134133
'GET',
135134
url_helpers.urljoin_keep_path(self.URL, 'tables'),
136-
{'action': 'getVizieRTableNames', 'RESPONSEFORMAT': 'txt'})
135+
{'action': 'getVizieRTableNames', 'RESPONSEFORMAT': 'txt'},
136+
cache=cache,
137+
)
137138

138139
content = response.text
139140

0 commit comments

Comments
 (0)