@@ -163,6 +163,10 @@ def __init__(self, service):
163
163
self .auth = service ['auth' ]
164
164
self .proto = service ['proto' ]
165
165
self .host = service ['host' ]
166
+ auth_param = {'token' : 'Authorization' ,
167
+ 'api_key' : 'X-API-KEY' ,
168
+ None : '' }
169
+ self .param_in = auth_param [service ['auth_type' ]]
166
170
167
171
def get_service_info (self ):
168
172
"""
@@ -178,7 +182,7 @@ def get_service_info(self):
178
182
:return: The body of the get result as a dictionary.
179
183
"""
180
184
postresult = requests .get ("%s://%s/ga4gh/wes/v1/service-info" % (self .proto , self .host ),
181
- headers = {"Authorization" : self .auth })
185
+ headers = {self . param_in : self .auth })
182
186
return wes_reponse (postresult )
183
187
184
188
def list_runs (self ):
@@ -194,7 +198,7 @@ def list_runs(self):
194
198
:return: The body of the get result as a dictionary.
195
199
"""
196
200
postresult = requests .get ("%s://%s/ga4gh/wes/v1/runs" % (self .proto , self .host ),
197
- headers = {"Authorization" : self .auth })
201
+ headers = {self . param_in : self .auth })
198
202
return wes_reponse (postresult )
199
203
200
204
def run (self , wf , jsonyaml , attachments ):
@@ -214,7 +218,7 @@ def run(self, wf, jsonyaml, attachments):
214
218
parts = build_wes_request (wf , jsonyaml , attachments )
215
219
postresult = requests .post ("%s://%s/ga4gh/wes/v1/runs" % (self .proto , self .host ),
216
220
files = parts ,
217
- headers = {"Authorization" : self .auth })
221
+ headers = {self . param_in : self .auth })
218
222
return wes_reponse (postresult )
219
223
220
224
def cancel (self , run_id ):
@@ -228,7 +232,7 @@ def cancel(self, run_id):
228
232
:return: The body of the delete result as a dictionary.
229
233
"""
230
234
postresult = requests .delete ("%s://%s/ga4gh/wes/v1/runs/%s" % (self .proto , self .host , run_id ),
231
- headers = {"Authorization" : self .auth })
235
+ headers = {self . param_in : self .auth })
232
236
return wes_reponse (postresult )
233
237
234
238
def get_run_log (self , run_id ):
@@ -242,7 +246,7 @@ def get_run_log(self, run_id):
242
246
:return: The body of the get result as a dictionary.
243
247
"""
244
248
postresult = requests .get ("%s://%s/ga4gh/wes/v1/runs/%s" % (self .proto , self .host , run_id ),
245
- headers = {"Authorization" : self .auth })
249
+ headers = {self . param_in : self .auth })
246
250
return wes_reponse (postresult )
247
251
248
252
def get_run_status (self , run_id ):
@@ -256,5 +260,5 @@ def get_run_status(self, run_id):
256
260
:return: The body of the get result as a dictionary.
257
261
"""
258
262
postresult = requests .get ("%s://%s/ga4gh/wes/v1/runs/%s/status" % (self .proto , self .host , run_id ),
259
- headers = {"Authorization" : self .auth })
263
+ headers = {self . param_in : self .auth })
260
264
return wes_reponse (postresult )
0 commit comments