@@ -110,11 +110,8 @@ def build_wes_request(workflow_file, json_path, attachments=None):
110
110
wf_params = json .dumps (json .load (f ))
111
111
elif json_path .startswith ("http" ):
112
112
wf_params = modify_jsonyaml_paths (json_path )
113
- else :
113
+ else :
114
114
wf_params = json_path
115
- with open (json_path ) as f :
116
- wf_params = json .dumps (json .load (f ))
117
-
118
115
wf_version , wf_type = wf_info (workflow_file )
119
116
120
117
parts = [("workflow_params" , wf_params ),
@@ -130,7 +127,7 @@ def build_wes_request(workflow_file, json_path, attachments=None):
130
127
if attachments :
131
128
for attachment in attachments :
132
129
if attachment .startswith ("file://" ):
133
- attachment = attachment [7 :]
130
+ attachment = attachment [7 :]
134
131
attach_f = open (attachment , "rb" )
135
132
elif attachment .startswith ("http" ):
136
133
attach_f = urlopen (attachment )
@@ -166,10 +163,6 @@ def __init__(self, service):
166
163
self .auth = service ['auth' ]
167
164
self .proto = service ['proto' ]
168
165
self .host = service ['host' ]
169
- auth_param = {'token' : 'Authorization' ,
170
- 'api_key' : 'X-API-KEY' ,
171
- None : 'Authorization' }
172
- self .param_in = auth_param [service ['auth_type' ]]
173
166
174
167
def get_service_info (self ):
175
168
"""
@@ -185,7 +178,7 @@ def get_service_info(self):
185
178
:return: The body of the get result as a dictionary.
186
179
"""
187
180
postresult = requests .get ("%s://%s/ga4gh/wes/v1/service-info" % (self .proto , self .host ),
188
- headers = {self . param_in : self .auth })
181
+ headers = {"Authorization" : self .auth })
189
182
return wes_reponse (postresult )
190
183
191
184
def list_runs (self ):
@@ -201,7 +194,7 @@ def list_runs(self):
201
194
:return: The body of the get result as a dictionary.
202
195
"""
203
196
postresult = requests .get ("%s://%s/ga4gh/wes/v1/runs" % (self .proto , self .host ),
204
- headers = {self . param_in : self .auth })
197
+ headers = {"Authorization" : self .auth })
205
198
return wes_reponse (postresult )
206
199
207
200
def run (self , wf , jsonyaml , attachments ):
@@ -221,7 +214,7 @@ def run(self, wf, jsonyaml, attachments):
221
214
parts = build_wes_request (wf , jsonyaml , attachments )
222
215
postresult = requests .post ("%s://%s/ga4gh/wes/v1/runs" % (self .proto , self .host ),
223
216
files = parts ,
224
- headers = {self . param_in : self .auth })
217
+ headers = {"Authorization" : self .auth })
225
218
return wes_reponse (postresult )
226
219
227
220
def cancel (self , run_id ):
@@ -235,7 +228,7 @@ def cancel(self, run_id):
235
228
:return: The body of the delete result as a dictionary.
236
229
"""
237
230
postresult = requests .delete ("%s://%s/ga4gh/wes/v1/runs/%s" % (self .proto , self .host , run_id ),
238
- headers = {self . param_in : self .auth })
231
+ headers = {"Authorization" : self .auth })
239
232
return wes_reponse (postresult )
240
233
241
234
def get_run_log (self , run_id ):
@@ -249,7 +242,7 @@ def get_run_log(self, run_id):
249
242
:return: The body of the get result as a dictionary.
250
243
"""
251
244
postresult = requests .get ("%s://%s/ga4gh/wes/v1/runs/%s" % (self .proto , self .host , run_id ),
252
- headers = {self . param_in : self .auth })
245
+ headers = {"Authorization" : self .auth })
253
246
return wes_reponse (postresult )
254
247
255
248
def get_run_status (self , run_id ):
@@ -263,5 +256,5 @@ def get_run_status(self, run_id):
263
256
:return: The body of the get result as a dictionary.
264
257
"""
265
258
postresult = requests .get ("%s://%s/ga4gh/wes/v1/runs/%s/status" % (self .proto , self .host , run_id ),
266
- headers = {self . param_in : self .auth })
259
+ headers = {"Authorization" : self .auth })
267
260
return wes_reponse (postresult )
0 commit comments