1
1
import os
2
2
import json
3
- from bravado . requests_client import RequestsClient
3
+ import requests
4
4
import urllib
5
5
import logging
6
6
import schema_salad .ref_resolver
@@ -102,7 +102,6 @@ def __init__(self, service):
102
102
self .auth = service ['auth' ]
103
103
self .proto = service ['proto' ]
104
104
self .host = service ['host' ]
105
- self .http_client = RequestsClient ()
106
105
107
106
def get_service_info (self ):
108
107
"""
@@ -118,8 +117,8 @@ def get_service_info(self):
118
117
:param host: Port where the post request will be sent and the wes server listens at (default 8080)
119
118
:return: The body of the get result as a dictionary.
120
119
"""
121
- postresult = self . http_client . session .get ("%s://%s/ga4gh/wes/v1/service-info" % (self .proto , self .host ),
122
- headers = {"Authorization" : self .auth })
120
+ postresult = requests .get ("%s://%s/ga4gh/wes/v1/service-info" % (self .proto , self .host ),
121
+ headers = {"Authorization" : self .auth })
123
122
return wes_reponse (postresult )
124
123
125
124
def list_runs (self ):
@@ -135,8 +134,8 @@ def list_runs(self):
135
134
:param host: Port where the post request will be sent and the wes server listens at (default 8080)
136
135
:return: The body of the get result as a dictionary.
137
136
"""
138
- postresult = self . http_client . session .get ("%s://%s/ga4gh/wes/v1/runs" % (self .proto , self .host ),
139
- headers = {"Authorization" : self .auth })
137
+ postresult = requests .get ("%s://%s/ga4gh/wes/v1/runs" % (self .proto , self .host ),
138
+ headers = {"Authorization" : self .auth })
140
139
return wes_reponse (postresult )
141
140
142
141
def run (self , wf , jsonyaml , attachments ):
@@ -154,52 +153,52 @@ def run(self, wf, jsonyaml, attachments):
154
153
:return: The body of the post result as a dictionary.
155
154
"""
156
155
parts = build_wes_request (wf , jsonyaml , attachments )
157
- postresult = self . http_client . session .post ("%s://%s/ga4gh/wes/v1/runs" % (self .proto , self .host ),
158
- files = parts ,
159
- headers = {"Authorization" : self .auth })
156
+ postresult = requests .post ("%s://%s/ga4gh/wes/v1/runs" % (self .proto , self .host ),
157
+ files = parts ,
158
+ headers = {"Authorization" : self .auth })
160
159
return wes_reponse (postresult )
161
160
162
161
def cancel (self , run_id ):
163
162
"""
164
163
Cancel a running workflow.
165
164
166
- :param run_id:
165
+ :param run_id: String (typically a uuid) identifying the run.
167
166
:param object http_client: bravado.requests_client.RequestsClient
168
167
:param str auth: String to send in the auth header.
169
168
:param proto: Schema where the server resides (http, https)
170
169
:param host: Port where the post request will be sent and the wes server listens at (default 8080)
171
170
:return: The body of the delete result as a dictionary.
172
171
"""
173
- postresult = self . http_client . session .delete ("%s://%s/ga4gh/wes/v1/runs/%s" % (self .proto , self .host , run_id ),
174
- headers = {"Authorization" : self .auth })
172
+ postresult = requests .delete ("%s://%s/ga4gh/wes/v1/runs/%s" % (self .proto , self .host , run_id ),
173
+ headers = {"Authorization" : self .auth })
175
174
return wes_reponse (postresult )
176
175
177
176
def get_run_log (self , run_id ):
178
177
"""
179
178
Get detailed info about a running workflow.
180
179
181
- :param run_id:
180
+ :param run_id: String (typically a uuid) identifying the run.
182
181
:param object http_client: bravado.requests_client.RequestsClient
183
182
:param str auth: String to send in the auth header.
184
183
:param proto: Schema where the server resides (http, https)
185
184
:param host: Port where the post request will be sent and the wes server listens at (default 8080)
186
185
:return: The body of the get result as a dictionary.
187
186
"""
188
- postresult = self . http_client . session .get ("%s://%s/ga4gh/wes/v1/runs/%s" % (self .proto , self .host , run_id ),
189
- headers = {"Authorization" : self .auth })
187
+ postresult = requests .get ("%s://%s/ga4gh/wes/v1/runs/%s" % (self .proto , self .host , run_id ),
188
+ headers = {"Authorization" : self .auth })
190
189
return wes_reponse (postresult )
191
190
192
191
def get_run_status (self , run_id ):
193
192
"""
194
193
Get quick status info about a running workflow.
195
194
196
- :param run_id:
195
+ :param run_id: String (typically a uuid) identifying the run.
197
196
:param object http_client: bravado.requests_client.RequestsClient
198
197
:param str auth: String to send in the auth header.
199
198
:param proto: Schema where the server resides (http, https)
200
199
:param host: Port where the post request will be sent and the wes server listens at (default 8080)
201
200
:return: The body of the get result as a dictionary.
202
201
"""
203
- postresult = self . http_client . session .get ("%s://%s/ga4gh/wes/v1/runs/%s/status" % (self .proto , self .host , run_id ),
204
- headers = {"Authorization" : self .auth })
202
+ postresult = requests .get ("%s://%s/ga4gh/wes/v1/runs/%s/status" % (self .proto , self .host , run_id ),
203
+ headers = {"Authorization" : self .auth })
205
204
return wes_reponse (postresult )
0 commit comments