mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-22 21:59:37 +08:00
Fix API misalignments with confirm material upload action
The API endpoint got renamed (without my awareness). It also needed to be a POST request, probably since the beginning. And apparently it needs everything to be in a sub-field called 'data' for some reason. Contributes to issue CURA-8609.
This commit is contained in:
parent
1c6ad019a3
commit
f99fedc58b
@ -46,7 +46,7 @@ class UploadMaterialsJob(Job):
|
||||
"""
|
||||
|
||||
UPLOAD_REQUEST_URL = f"{UltimakerCloudConstants.CuraCloudAPIRoot}/connect/v1/materials/upload"
|
||||
UPLOAD_CONFIRM_URL = UltimakerCloudConstants.CuraCloudAPIRoot + "/connect/v1/clusters/{cluster_id}/printers/{cluster_printer_id}/action/confirm_material_upload"
|
||||
UPLOAD_CONFIRM_URL = UltimakerCloudConstants.CuraCloudAPIRoot + "/connect/v1/clusters/{cluster_id}/printers/{cluster_printer_id}/action/import_material"
|
||||
|
||||
class Result(enum.IntEnum):
|
||||
SUCCESS = 0
|
||||
@ -175,11 +175,12 @@ class UploadMaterialsJob(Job):
|
||||
printer_id = container_stack["host_guid"]
|
||||
|
||||
http = HttpRequestManager.getInstance()
|
||||
http.get(
|
||||
http.post(
|
||||
url = self.UPLOAD_CONFIRM_URL.format(cluster_id = cluster_id, cluster_printer_id = printer_id),
|
||||
callback = lambda reply, error: self.onUploadConfirmed(printer_id, reply, error),
|
||||
callback = lambda reply: self.onUploadConfirmed(printer_id, reply, None),
|
||||
error_callback = lambda reply, error: self.onUploadConfirmed(printer_id, reply, error), # Let this same function handle the error too.
|
||||
scope = self._scope
|
||||
scope = self._scope,
|
||||
data = json.dumps({"data": {"material_profile_id": self._archive_remote_id}}).encode("UTF-8")
|
||||
)
|
||||
|
||||
def onUploadConfirmed(self, printer_id: str, reply: "QNetworkReply", error: Optional["QNetworkReply.NetworkError"] = None) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user