@@ -226,7 +226,10 @@ def _load_atom_entries(response):
226
226
227
227
228
228
# Load the sid from the body of the given response
229
- def _load_sid (response ):
229
+ def _load_sid (response , output_mode ):
230
+ if output_mode == "json" :
231
+ json_obj = json .loads (response .body .read ())
232
+ return json_obj .get ('sid' )
230
233
return _load_atom (response ).response .sid
231
234
232
235
@@ -2957,7 +2960,7 @@ def create(self, query, **kwargs):
2957
2960
if kwargs .get ("exec_mode" , None ) == "oneshot" :
2958
2961
raise TypeError ("Cannot specify exec_mode=oneshot; use the oneshot method instead." )
2959
2962
response = self .post (search = query , ** kwargs )
2960
- sid = _load_sid (response )
2963
+ sid = _load_sid (response , kwargs . get ( "output_mode" , None ) )
2961
2964
return Job (self .service , sid )
2962
2965
2963
2966
def export (self , query , ** params ):
@@ -3173,7 +3176,7 @@ def dispatch(self, **kwargs):
3173
3176
:return: The :class:`Job`.
3174
3177
"""
3175
3178
response = self .post ("dispatch" , ** kwargs )
3176
- sid = _load_sid (response )
3179
+ sid = _load_sid (response , kwargs . get ( "output_mode" , None ) )
3177
3180
return Job (self .service , sid )
3178
3181
3179
3182
@property
0 commit comments