Change api methods to use POST when possible

This commit is contained in:
Brett Williams
2026-06-06 00:49:56 -05:00
parent 076eebcdac
commit b8f025ccba
2 changed files with 14 additions and 5 deletions
+7 -2
View File
@@ -109,6 +109,11 @@ class RenderServerProxy:
return requests.get(f'http://{self.hostname}:{self.port}/api/{payload}', timeout=timeout,
headers={"X-API-Version": str(API_VERSION)})
def _post(self, payload, timeout=5, **kwargs):
from src.api.api_server import API_VERSION
return requests.post(f'http://{self.hostname}:{self.port}/api/{payload}', timeout=timeout,
headers={"X-API-Version": str(API_VERSION)}, **kwargs)
# --------------------------------------------
# Background Updates:
# --------------------------------------------
@@ -225,10 +230,10 @@ class RenderServerProxy:
return response
def cancel_job(self, job_id, confirm=False):
return self.request_data(f'job/{job_id}/cancel?confirm={confirm}')
return self._post(f'job/{job_id}/cancel', params={'confirm': confirm})
def delete_job(self, job_id, confirm=False):
return self.request_data(f'job/{job_id}/delete?confirm={confirm}')
return self._post(f'job/{job_id}/delete', params={'confirm': confirm})
def send_subjob_update_notification(self, parent_id, subjob):
"""