MCPcopy Create free account
hub / github.com/AstroPrint/AstroBox / printerBedCommand

Function printerBedCommand

src/astroprint/api/printer.py:143–168  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

141@api.route("/printer/bed", methods=["POST"])
142@restricted_access
143def 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"])

Callers

nothing calls this directly

Calls 3

printerManagerFunction · 0.90
isOperationalMethod · 0.45
setTemperatureMethod · 0.45

Tested by

no test coverage detected