20
20
from pathlib import Path
21
21
import tarfile
22
22
import os
23
+ from astroquery import log
24
+ import configparser
23
25
24
26
from astropy .io import fits
25
27
from . import conf , config
26
28
from astroquery import log
27
29
from astropy .coordinates import SkyCoord
28
30
from ...exceptions import LoginError
29
31
30
-
31
32
__all__ = ['XMMNewton' , 'XMMNewtonClass' ]
32
33
33
34
34
35
class XMMNewtonClass (BaseQuery ):
35
-
36
36
data_url = conf .DATA_ACTION
37
37
data_aio_url = conf .DATA_ACTION_AIO
38
38
metadata_url = conf .METADATA_ACTION
39
39
TIMEOUT = conf .TIMEOUT
40
40
41
41
def __init__ (self , tap_handler = None ):
42
42
super (XMMNewtonClass , self ).__init__ ()
43
+ self .configuration = configparser .ConfigParser ()
43
44
44
45
if tap_handler is None :
45
46
self ._tap = TapPlus (url = "https://nxsa.esac.esa.int/tap-server/tap" )
@@ -48,7 +49,7 @@ def __init__(self, tap_handler=None):
48
49
self ._rmf_ftp = str ("http://sasdev-xmm.esac.esa.int/pub/ccf/constituents/extras/responses/" )
49
50
50
51
def download_data (self , observation_id , * , filename = None , verbose = False ,
51
- cache = True , prop = False , username = None , password = None , ** kwargs ):
52
+ cache = True , prop = False , credentials_file = None , ** kwargs ):
52
53
"""
53
54
Download data from XMM-Newton
54
55
@@ -113,7 +114,11 @@ def download_data(self, observation_id, *, filename=None, verbose=False,
113
114
# If the user wants to access proprietary data, ask them for there credentials
114
115
if prop :
115
116
username , password = self ._get_username_and_password (credentials_file )
117
+ < << << << HEAD
116
118
link = f"{ link } &AIOUSER={ username } &AIOPWD={ password } "
119
+ == == == =
120
+ link = link + "&AIOUSER=" + username + "&AIOPWD=" + password
121
+ >> >> >> > 40576 ad4 (xmm_newton - 1.1_ issue1093 Refactored the download data method and added the corresponding tests )
117
122
118
123
if verbose :
119
124
log .info (link )
@@ -130,7 +135,11 @@ def download_data(self, observation_id, *, filename=None, verbose=False,
130
135
self ._download_file (link , filename , head_safe = True , cache = cache )
131
136
132
137
if verbose :
138
+ < << << << HEAD
133
139
log .info (f"Wrote { link } to { filename } " )
140
+ == == == =
141
+ log .info ("Wrote {0} to {1}" .format (link , filename ))
142
+ >> >> >> > 40576 ad4 (xmm_newton - 1.1_ issue1093 Refactored the download data method and added the corresponding tests )
134
143
log .setLevel (previouslevel )
135
144
136
145
def get_postcard (self , observation_id , * , image_type = "OBS_EPIC" ,
@@ -277,7 +286,11 @@ def get_columns(self, table_name, *, only_names=True, verbose=False):
277
286
return columns
278
287
279
288
def _create_link (self , observation_id , ** kwargs ):
289
+ < << << << HEAD
280
290
link = f"{ self .data_aio_url } obsno={ observation_id } "
291
+ == == == =
292
+ link = self .data_aio_url + "obsno=" + observation_id
293
+ >> >> >> > 40576 ad4 (xmm_newton - 1.1_ issue1093 Refactored the download data method and added the corresponding tests )
281
294
link = link + "" .join ("&{0}={1}" .format (key , val )
282
295
for key , val in kwargs .items ())
283
296
return link
0 commit comments