@@ -163,6 +163,10 @@ def __init__(self, service):
163163 self .auth = service ['auth' ]
164164 self .proto = service ['proto' ]
165165 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' ]]
166170
167171 def get_service_info (self ):
168172 """
@@ -178,7 +182,7 @@ def get_service_info(self):
178182 :return: The body of the get result as a dictionary.
179183 """
180184 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 })
182186 return wes_reponse (postresult )
183187
184188 def list_runs (self ):
@@ -194,7 +198,7 @@ def list_runs(self):
194198 :return: The body of the get result as a dictionary.
195199 """
196200 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 })
198202 return wes_reponse (postresult )
199203
200204 def run (self , wf , jsonyaml , attachments ):
@@ -214,7 +218,7 @@ def run(self, wf, jsonyaml, attachments):
214218 parts = build_wes_request (wf , jsonyaml , attachments )
215219 postresult = requests .post ("%s://%s/ga4gh/wes/v1/runs" % (self .proto , self .host ),
216220 files = parts ,
217- headers = {"Authorization" : self .auth })
221+ headers = {self . param_in : self .auth })
218222 return wes_reponse (postresult )
219223
220224 def cancel (self , run_id ):
@@ -228,7 +232,7 @@ def cancel(self, run_id):
228232 :return: The body of the delete result as a dictionary.
229233 """
230234 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 })
232236 return wes_reponse (postresult )
233237
234238 def get_run_log (self , run_id ):
@@ -242,7 +246,7 @@ def get_run_log(self, run_id):
242246 :return: The body of the get result as a dictionary.
243247 """
244248 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 })
246250 return wes_reponse (postresult )
247251
248252 def get_run_status (self , run_id ):
@@ -256,5 +260,5 @@ def get_run_status(self, run_id):
256260 :return: The body of the get result as a dictionary.
257261 """
258262 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 })
260264 return wes_reponse (postresult )
0 commit comments