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

Method startPrintCapture

src/astroprint/cloud.py:667–706  ·  view source on GitHub ↗
(self, filename)

Source from the content-addressed store, hash-verified

665 return None
666
667 def startPrintCapture(self, filename):
668 data = {'name': filename}
669
670 pm = printerManager()
671
672 print_file_id = pm.fileManager.getFileCloudId(filename)
673 print_job_id = pm.currentPrintJobId
674
675 if print_file_id:
676 data['print_file_id'] = print_file_id
677
678 if print_job_id:
679 data['print_job_id'] = print_job_id
680
681 try:
682 r = requests.post(
683 "%s/prints" % self.apiHost,
684 data= data,
685 auth= self.hmacAuth
686 )
687 status_code = r.status_code
688 except:
689 status_code = 500
690
691 if status_code == 201:
692 data = r.json()
693 return {
694 "error": False,
695 "print_id": data['print_id']
696 }
697
698 if status_code == 402:
699 return {
700 "error": "no_storage"
701 }
702
703 else:
704 return {
705 "error": "unable_to_create"
706 }
707
708 def updateBoxrouterData(self, data):
709 if self.cloud_enabled():

Callers 1

start_timelapseMethod · 0.80

Calls 3

printerManagerFunction · 0.90
getFileCloudIdMethod · 0.80
postMethod · 0.45

Tested by

no test coverage detected