@@ -274,7 +274,7 @@ def login_as_root(self, domain=None, payload=None):
274
274
except (WindowsError ) as err :
275
275
raise APIClientException ("Could not login as root:\n " + str (type (err )) + " - " + str (err ))
276
276
277
- def api_call (self , command , payload = None , sid = None , wait_for_task = True , timeout = - 1 ):
277
+ def api_call (self , command , payload = None , sid = None , wait_for_task = True , timeout = - 1 , method = "POST" ):
278
278
"""
279
279
performs a web-service API request to the management server
280
280
@@ -287,6 +287,7 @@ def api_call(self, command, payload=None, sid=None, wait_for_task=True, timeout=
287
287
when wait_for_task=False, it is up to the user to call the "show-task" API and check
288
288
the status of the command.
289
289
:param timeout: Optional positive timeout (in seconds) before stop waiting for the task even if not completed.
290
+ :param method: The HTTP method to use. Defaults is `POST`.
290
291
:return: APIResponse object
291
292
:side-effects: updates the class's uid and server variables
292
293
"""
@@ -336,7 +337,7 @@ def api_call(self, command, payload=None, sid=None, wait_for_task=True, timeout=
336
337
response = None
337
338
try :
338
339
# Send the data to the server
339
- conn .request ("POST" , url , _data , _headers )
340
+ conn .request (method , url , _data , _headers )
340
341
# Get the reply from the server
341
342
response = conn .getresponse ()
342
343
res = APIResponse .from_http_response (response )
0 commit comments