@@ -110,11 +110,8 @@ def build_wes_request(workflow_file, json_path, attachments=None):
110110 wf_params = json .dumps (json .load (f ))
111111 elif json_path .startswith ("http" ):
112112 wf_params = modify_jsonyaml_paths (json_path )
113- else :
113+ else :
114114 wf_params = json_path
115- with open (json_path ) as f :
116- wf_params = json .dumps (json .load (f ))
117-
118115 wf_version , wf_type = wf_info (workflow_file )
119116
120117 parts = [("workflow_params" , wf_params ),
@@ -130,7 +127,7 @@ def build_wes_request(workflow_file, json_path, attachments=None):
130127 if attachments :
131128 for attachment in attachments :
132129 if attachment .startswith ("file://" ):
133- attachment = attachment [7 :]
130+ attachment = attachment [7 :]
134131 attach_f = open (attachment , "rb" )
135132 elif attachment .startswith ("http" ):
136133 attach_f = urlopen (attachment )
@@ -166,10 +163,6 @@ def __init__(self, service):
166163 self .auth = service ['auth' ]
167164 self .proto = service ['proto' ]
168165 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' ]]
173166
174167 def get_service_info (self ):
175168 """
@@ -185,7 +178,7 @@ def get_service_info(self):
185178 :return: The body of the get result as a dictionary.
186179 """
187180 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 })
189182 return wes_reponse (postresult )
190183
191184 def list_runs (self ):
@@ -201,7 +194,7 @@ def list_runs(self):
201194 :return: The body of the get result as a dictionary.
202195 """
203196 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 })
205198 return wes_reponse (postresult )
206199
207200 def run (self , wf , jsonyaml , attachments ):
@@ -221,7 +214,7 @@ def run(self, wf, jsonyaml, attachments):
221214 parts = build_wes_request (wf , jsonyaml , attachments )
222215 postresult = requests .post ("%s://%s/ga4gh/wes/v1/runs" % (self .proto , self .host ),
223216 files = parts ,
224- headers = {self . param_in : self .auth })
217+ headers = {"Authorization" : self .auth })
225218 return wes_reponse (postresult )
226219
227220 def cancel (self , run_id ):
@@ -235,7 +228,7 @@ def cancel(self, run_id):
235228 :return: The body of the delete result as a dictionary.
236229 """
237230 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 })
239232 return wes_reponse (postresult )
240233
241234 def get_run_log (self , run_id ):
@@ -249,7 +242,7 @@ def get_run_log(self, run_id):
249242 :return: The body of the get result as a dictionary.
250243 """
251244 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 })
253246 return wes_reponse (postresult )
254247
255248 def get_run_status (self , run_id ):
@@ -263,5 +256,5 @@ def get_run_status(self, run_id):
263256 :return: The body of the get result as a dictionary.
264257 """
265258 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 })
267260 return wes_reponse (postresult )
0 commit comments