Skip to content

Commit fbf335b

Browse files
authored
Merge pull request #1266 from esdc-esac-esa-int/tap_1_2
Tap 1.2.1
2 parents 0604df7 + 2e53be9 commit fbf335b

26 files changed

+3980
-702
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
to stop them silently breaking Table parsing [#1431]
1919
- utils: adding deprecation decorators from astropy to be used while we
2020
support astropy v3.1.2. [#1435]
21+
- Gaia: added tables sharing, tables edition, upload from pytable and job results, cross match, data access and datalink access. [#1266]
22+
- utils.tap: added tables sharing, tables edition, upload from pytable and job results, data access and datalink access. [#1266]
2123

2224
0.3.9 (2018-12-06)
2325
------------------

astroquery/cadc/cadctap/core.py

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from astroquery.utils.tap.core import TapPlus
1515
from astroquery.cadc.cadctap.tapconn import TapConnCadc
1616
from astroquery.cadc.cadctap.jobSaxParser import JobSaxParserCadc
17+
from astroquery.utils.tap import taputils
1718

1819

1920
__all__ = ['TapPlusCadc']
@@ -74,31 +75,35 @@ def __init__(self, url=None, host=None, server_context=None,
7475
tap_context = self._Tap__parseUrl(url)
7576
if protocol == "http":
7677
connHandler = TapConnCadc(False,
77-
host,
78-
server_context,
79-
tap_context,
80-
port,
81-
sslport)
78+
host=host,
79+
server_context=server_context,
80+
tap_context=tap_context,
81+
port=port,
82+
sslport=sslport)
8283
else:
8384
# https port -> sslPort
8485
connHandler = TapConnCadc(True,
85-
host,
86-
server_context,
87-
tap_context,
88-
port,
89-
port)
86+
host=host,
87+
server_context=server_context,
88+
tap_context=tap_context,
89+
port=port,
90+
sslport=port)
9091
else:
9192
connHandler = TapConnCadc(default_protocol_is_https,
92-
host,
93-
server_context,
94-
tap_context,
95-
port,
96-
sslport)
93+
host=host,
94+
server_context=server_context,
95+
tap_context=tap_context,
96+
port=port,
97+
sslport=sslport)
9798
self.__certificate = None
98-
super(TapPlusCadc, self).__init__(url, host, server_context,
99-
tap_context, port, sslport,
100-
default_protocol_is_https,
101-
connHandler, verbose)
99+
super(TapPlusCadc, self).__init__(url=url, host=host,
100+
server_context=server_context,
101+
tap_context=tap_context, port=port,
102+
sslport=sslport,
103+
default_protocol_is_https=default_protocol_is_https,
104+
105+
connhandler=connHandler,
106+
verbose=verbose)
102107

103108
def load_table(self, table, verbose=False):
104109
"""Loads the specified table
@@ -130,7 +135,8 @@ def load_table(self, table, verbose=False):
130135
return
131136

132137
def _Tap__launchJobMultipart(self, query, uploadResource, uploadTableName,
133-
outputFormat, context, verbose, name=None):
138+
outputFormat, context, verbose, name=None,
139+
autorun=True):
134140
"""
135141
136142
Notes
@@ -152,9 +158,8 @@ def _Tap__launchJobMultipart(self, query, uploadResource, uploadTableName,
152158
files = [[uploadTableName, uploadResource, chunk]]
153159
contentType, body = self._Tap__connHandler.encode_multipart(args,
154160
files)
155-
response = self._Tap__connHandler.execute_post(context,
156-
body,
157-
contentType)
161+
response = self._Tap__connHandler.execute_tappost(context, body,
162+
contentType)
158163
if verbose:
159164
print(response.status, response.reason)
160165
print(response.getheaders())
@@ -163,13 +168,13 @@ def _Tap__launchJobMultipart(self, query, uploadResource, uploadTableName,
163168
location = self._Tap__connHandler.find_header(
164169
response.getheaders(),
165170
"location")
166-
jobid = self._Tap__getJobId(location)
171+
jobid = taputils.get_jobid_from_location(location)
167172
runresponse = self.__runAsyncQuery(jobid, verbose)
168173
return runresponse
169174
return response
170175

171176
def _Tap__launchJob(self, query, outputFormat,
172-
context, verbose, name=None):
177+
context, verbose, name=None, autorun=True):
173178
"""
174179
175180
Notes
@@ -184,15 +189,15 @@ def _Tap__launchJob(self, query, outputFormat,
184189
"tapclient": str(TAP_CLIENT_ID),
185190
"QUERY": str(query)}
186191
data = self._Tap__connHandler.url_encode(args)
187-
response = self._Tap__connHandler.execute_post(context, data)
192+
response = self._Tap__connHandler.execute_tappost(context, data)
188193
if verbose:
189194
print(response.status, response.reason)
190195
print(response.getheaders())
191196
if 'async' in context:
192197
location = self._Tap__connHandler.find_header(
193198
response.getheaders(),
194199
"location")
195-
jobid = self._Tap__getJobId(location)
200+
jobid = taputils.get_jobid_from_location(location)
196201
runresponse = self.__runAsyncQuery(jobid, verbose)
197202
return runresponse
198203
return response
@@ -206,8 +211,8 @@ def __runAsyncQuery(self, jobid, verbose):
206211
args = {
207212
"PHASE": "RUN"}
208213
data = self._Tap__connHandler.url_encode(args)
209-
response = self._Tap__connHandler.execute_post('async/'+jobid+'/phase',
210-
data)
214+
response = self._Tap__connHandler.execute_tappost('async/'+jobid+'/phase',
215+
data)
211216
if verbose:
212217
print(response.status, response.reason)
213218
print(response.getheaders())
@@ -237,7 +242,7 @@ def load_async_job(self, jobid=None, verbose=False):
237242
print("No job identifier found")
238243
return
239244
subContext = "async/" + str(jobid)
240-
response = self._Tap__connHandler.execute_get(subContext)
245+
response = self._Tap__connHandler.execute_tapget(subContext)
241246
if verbose:
242247
print(response.status, response.reason)
243248
print(response.getheaders())
@@ -310,6 +315,7 @@ def login(self, user=None, password=None, certificate_file=None,
310315
raise AttributeError(
311316
'Choose one form of authentication only')
312317
if certificate_file is not None:
318+
print(dir(self._TapPlus__getconnhandler().cookies_set))
313319
if self._TapPlus__getconnhandler().cookies_set():
314320
raise AttributeError('Already logged in with user/password')
315321
if not os.path.isfile(certificate_file):

astroquery/cadc/cadctap/job.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def save_results(self, filename, verbose=False):
103103
# Async
104104
self.wait_for_job_end(verbose)
105105
context = 'async/' + str(self.jobid) + "/results/result"
106-
response = self.connHandler.execute_get(context)
106+
response = self.connHandler.execute_tapget(context)
107107
if verbose:
108108
print(response.status, response.reason)
109109
print(response.getheaders())
@@ -162,7 +162,7 @@ def abortJob(self, verbose):
162162
args = {
163163
"PHASE": "ABORT"}
164164
data = self.connHandler.url_encode(args)
165-
response = self.connHandler.execute_post(
165+
response = self.connHandler.execute_tappost(
166166
'async/'+str(self.jobid)+'/phase',
167167
data)
168168
if verbose:
@@ -180,7 +180,7 @@ def __load_async_job_results(self, debug=False):
180180
if wjData != 'COMPLETED':
181181
if wjData == 'ERROR':
182182
subcontext = 'async/' + self.jobid
183-
errresponse = self.connHandler.execute_get(
183+
errresponse = self.connHandler.execute_tapget(
184184
subcontext)
185185
# parse job
186186
jsp = astroquery.cadc.cadctap.jobSaxParser. \
@@ -193,7 +193,7 @@ def __load_async_job_results(self, debug=False):
193193
raise requests.exceptions.HTTPError(
194194
'Error running query, PHASE: '+wjData)
195195
subContext = "async/" + str(self.jobid) + "/results/result"
196-
resultsResponse = self.connHandler.execute_get(subContext)
196+
resultsResponse = self.connHandler.execute_tapget(subContext)
197197
if debug:
198198
print(resultsResponse.status, resultsResponse.reason)
199199
print(resultsResponse.getheaders())

astroquery/gaia/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class Conf(_config.ConfigNamespace):
3434

3535
conf = Conf()
3636

37-
gaia = TapPlus(url="http://gea.esac.esa.int/tap-server/tap", verbose=False)
3837

3938
from .core import Gaia, GaiaClass
4039

40+
4141
__all__ = ['Gaia', 'GaiaClass', 'Conf', 'conf']

0 commit comments

Comments
 (0)