I am creating an OctoPrint plugin.
Uses Python and Kivy.
I am having trouble with the 'select' function of the 'files' API.
I can list all the files with no problem, and I can choose from the list, but I can not get the API to 'Select' the file so it can be printed.
If I issue the following file segment:
def select_file (self, onelinelistitem):
print ('file: ', onelinelistitem.text)
file_data = {'command':'select', 'print': False}
print(filesapiurl + '/local/' + onelinelistitem.text + str(file_data))
r = requests.post(filesapiurl + '/local/' + onelinelistitem.text, headers=headers, json=file_data, timeout=httptimeout)
print('STATUS CODE: ' + str(r.status_code))
I get the following output on the console:
file: Seifenhalter.gcode
http://127.0.0.1:5000/api/files/local/Seifenhalter.gcode{'command': 'select', 'print': False}
STATUS CODE: 409
So it seems that the request is not malformed, but can not be processed.
Any suggestions?