You are not logged in.
I am trying to add plate via API call through Python code. I start Nano dlp server and load file like
data={some data}
files = {'ZipFile': (filename, open(filePath, 'rb'))}
result = requests.post("http://127.0.0.1:8080/plate/add", files=files, data=data, timeout=100)
it return <Response [200]> but plate is not added.
I can't figure out the issue.
Anyone please help me. Even in same way I write code to get list of plates. but result same response code 200 but how I can get data
Offline
Well, I have neither knowldge nor experiece with python. By incident I implemented such a request successfully with javascript a couple of days ago.
From the looking on your code, I wonder about the lines...
data={some data}
files = {'ZipFile': (filename, open(filePath, 'rb'))}
I wouldn't expected the "open" expression to be located the "files =..." line. But thats maybe some python related thing I don't understand.
Following is the javascript code I wrote (it's tested and works fine):
var fs = require("fs");
var buffer = fs.readFileSync( path + "/" + file);
let result = request( {
uri: global.SERVER_URL + "/plate/add",
formData: {
'ZipFile': {
value: buffer,
options: {
filename: file
}
},
'Path': file,
'ProfileID': prid
},
method: 'POST'
});
variables...
buffer -> will be filled by fs.readFileSync() with the content of the STL-file
path -> path of the STL-file, excluding the filename
file -> filename of the STL-file, excluding the path
prid -> integer for the profile-id
Offline
Thanks. It was sorted. Issue was in data set.
Offline