I am having problems trying to automatize my Duet uploads.
I use pycurl to upload to rr_upload. And it is being successful most of the times, but every now and then the same file makes our duets to stop responding with a URL ERROR [[Errno 111] Connection refused.
The printers keeps printing, but we cannot longer communicate with it. I tried different firmware versions.
I can ping the printer and it responds back.
Anyone experienced this kind of problem before?
Here is my current code to upload to the duet
c = pycurl.Curl() upload_url = "http://%s/rr_upload?name=gcodes/%s&time=%s" % (self.config['ip'], onlyfiles, get_timestamp()) file_name = join(self.print_folder, onlyfiles) c.setopt(c.HTTPHEADER, ["Content-type: application/json"]) c.setopt(c.URL, upload_url) c.setopt(c.POST, 1) c.setopt(c.VERBOSE, False) file = open(file_name, "r") c.setopt(c.POSTFIELDS, file.read()) c.perform() c.close() file.close()
Is there any example of using python to upload into the Duets?