mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-11 08:47:50 -06:00
Clean up CloudApiClient.py
This commit is contained in:
parent
8012df6518
commit
484cc6d42f
1 changed files with 25 additions and 21 deletions
|
@ -178,6 +178,7 @@ class CloudApiClient:
|
||||||
:param cluster_id: The ID of the cluster.
|
:param cluster_id: The ID of the cluster.
|
||||||
:param cluster_job_id: The ID of the print job within the cluster.
|
:param cluster_job_id: The ID of the print job within the cluster.
|
||||||
:param action: The name of the action to execute.
|
:param action: The name of the action to execute.
|
||||||
|
:param data: Optional data to send with the POST request
|
||||||
"""
|
"""
|
||||||
|
|
||||||
body = json.dumps({"data": data}).encode() if data else b""
|
body = json.dumps({"data": data}).encode() if data else b""
|
||||||
|
@ -220,8 +221,11 @@ class CloudApiClient:
|
||||||
Logger.logException("e", "Could not parse the stardust response: %s", error.toDict())
|
Logger.logException("e", "Could not parse the stardust response: %s", error.toDict())
|
||||||
return status_code, {"errors": [error.toDict()]}
|
return status_code, {"errors": [error.toDict()]}
|
||||||
|
|
||||||
def _parseResponse(self, response: Dict[str, Any], on_finished: Union[Callable[[CloudApiClientModel], Any],
|
def _parseResponse(self,
|
||||||
Callable[[List[CloudApiClientModel]], Any]], model_class: Type[CloudApiClientModel]) -> None:
|
response: Dict[str, Any],
|
||||||
|
on_finished: Union[Callable[[CloudApiClientModel], Any],
|
||||||
|
Callable[[List[CloudApiClientModel]], Any]],
|
||||||
|
model_class: Type[CloudApiClientModel]) -> None:
|
||||||
"""Parses the given response and calls the correct callback depending on the result.
|
"""Parses the given response and calls the correct callback depending on the result.
|
||||||
|
|
||||||
:param response: The response from the server, after being converted to a dict.
|
:param response: The response from the server, after being converted to a dict.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue