@@ -226,8 +226,12 @@ 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 ):
230
- return _load_atom (response ).response .sid
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' )
233
+ else :
234
+ return _load_atom (response ).response .sid
231
235
232
236
233
237
# Parse the given atom entry record into a generic entity state record
@@ -2968,7 +2972,7 @@ def create(self, query, **kwargs):
2968
2972
if kwargs .get ("exec_mode" , None ) == "oneshot" :
2969
2973
raise TypeError ("Cannot specify exec_mode=oneshot; use the oneshot method instead." )
2970
2974
response = self .post (search = query , ** kwargs )
2971
- sid = _load_sid (response )
2975
+ sid = _load_sid (response , kwargs . get ( "output_mode" , None ) )
2972
2976
return Job (self .service , sid )
2973
2977
2974
2978
def export (self , query , ** params ):
@@ -3184,7 +3188,7 @@ def dispatch(self, **kwargs):
3184
3188
:return: The :class:`Job`.
3185
3189
"""
3186
3190
response = self .post ("dispatch" , ** kwargs )
3187
- sid = _load_sid (response )
3191
+ sid = _load_sid (response , kwargs . get ( "output_mode" , None ) )
3188
3192
return Job (self .service , sid )
3189
3193
3190
3194
@property
0 commit comments