Convert parameters to string before including them

This way you can provide normal floating point values instead of providing strings with numbers in them.

Contributes to issue CURA-3161.
This commit is contained in:
Ghostkeeper 2017-02-07 13:26:10 +01:00
parent d7bf23ca21
commit 0df4afff33
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -248,7 +248,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
# to a quarter hour.
def preheatBed(self, temperature, duration=900):
url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/pre_heat")
data = """{"temperature": "{temperature}", "timeout": "{timeout}"}""".format(temperature=temperature, timeout=duration)
data = """{"temperature": "{temperature}", "timeout": "{timeout}"}""".format(temperature=str(temperature), timeout=str(duration))
put_request = QNetworkRequest(url)
put_request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json")
self._manager.put(put_request, data.encode())