Exemple #1
0
def pause_print():
    try:
        client = OctoClient(url=URL, apikey=API_KEY)
        flags = client.printer()['state']['flags']
        if flags['printing']:
            client.pause()
            print("Print paused.")
            print("Layer: " + str(LAYER))
        elif flags['paused'] or flags['pausing']:
            print("Print already paused.")
        else:
            print("Print cancelled or error occurred.")
    except Exception as e:
        print(e)
Exemple #2
0
 def pause(printer: Printer):
     """
     Issues pause print command to OctoPrint
     Returns response with 204/No Content
     """
     client = OctoClient(url=printer.url, apikey=printer.apikey)
     return client.pause()