()
| 141 | @api.route("/printer/bed", methods=["POST"]) |
| 142 | @restricted_access |
| 143 | def printerBedCommand(): |
| 144 | pm = printerManager() |
| 145 | |
| 146 | if not pm.isOperational(): |
| 147 | return make_response("Printer is not operational", 409) |
| 148 | |
| 149 | valid_commands = { |
| 150 | "target": ["target"], |
| 151 | "offset": ["offset"] |
| 152 | } |
| 153 | command, data, response = util.getJsonCommandFromRequest(request, valid_commands) |
| 154 | if response is not None: |
| 155 | return response |
| 156 | |
| 157 | ##~~ temperature |
| 158 | if command == "target": |
| 159 | target = data["target"] |
| 160 | |
| 161 | # make sure the target is a number |
| 162 | if not isinstance(target, (int, long, float)): |
| 163 | return make_response("Not a number: %r" % target, 400) |
| 164 | |
| 165 | # perform the actual temperature command |
| 166 | pm.setTemperature("bed", target) |
| 167 | |
| 168 | return NO_CONTENT |
| 169 | |
| 170 | |
| 171 | @api.route("/printer/bed", methods=["GET"]) |
nothing calls this directly
no test coverage detected