| 754 | self._logger.error(e) |
| 755 | |
| 756 | def uploadImageFile(self, print_id, imageBuf): |
| 757 | try: |
| 758 | m = MultipartEncoder(fields=[('file',('snapshot.jpg', imageBuf))]) |
| 759 | r = requests.post( |
| 760 | "%s/prints/%s/image" % (self.apiHost, print_id), |
| 761 | data= m, |
| 762 | headers= {'Content-Type': m.content_type}, |
| 763 | auth= self.hmacAuth |
| 764 | ) |
| 765 | m = None #Free the memory? |
| 766 | status_code = r.status_code |
| 767 | except: |
| 768 | status_code = 500 |
| 769 | |
| 770 | if status_code == 201: |
| 771 | data = r.json() |
| 772 | return data |
| 773 | |
| 774 | else: |
| 775 | return None |
| 776 | |
| 777 | def print_job(self, id= None, print_file_id= None, print_file_name= None, status= 'started', reason= None, materialUsed= None): |
| 778 | if self.cloud_enabled(): |