(filter)
| 424 | |
| 425 | |
| 426 | def _getTemperatureData(filter): |
| 427 | pm = printerManager() |
| 428 | |
| 429 | if not pm.isOperational(): |
| 430 | return make_response("Printer is not operational", 409) |
| 431 | |
| 432 | tempData = pm.getCurrentTemperatures() |
| 433 | |
| 434 | if "history" in request.values.keys() and request.values["history"] in valid_boolean_trues: |
| 435 | tempHistory = pm.getTemperatureHistory() |
| 436 | |
| 437 | limit = 300 |
| 438 | if "limit" in request.values.keys() and unicode(request.values["limit"]).isnumeric(): |
| 439 | limit = int(request.values["limit"]) |
| 440 | |
| 441 | history = list(tempHistory) |
| 442 | limit = min(limit, len(history)) |
| 443 | |
| 444 | tempData.update({ |
| 445 | "history": map(lambda x: filter(x), history[-limit:]) |
| 446 | }) |
| 447 | |
| 448 | return filter(tempData) |
| 449 | |
| 450 | ##~~ Comms |
| 451 |
no test coverage detected