Here is source code for test.py
Using python 2.7, have tried without x-mtok and with.
var2 = 'some\\path\\with\\stuff\\'
for file in os.listdir(var2):
filepath = var2+file
print('output_file',var2+file)
sys.stdout.flush()
#get file info
fileId = str(uuid.uuid4())
fileSize = str(os.path.getsize(filepath))
print 'got file info. fileId: '+fileId+' fileSize: '+fileSize
#send meta data to POST
print 'sending meta data and first byte'
headers = {"x-mtok": "x5PfcjwqDhG39xBTE", "x-start": "1"}
body = {"fileId": fileId, "chunkSize": fileSize, "fileLength": "1"}
body["file"] = {"name": file, "type":"text/plain", "size": fileSize, "meta": {}}
r = requests.post("http://localhost:3000/cdn/storage/Output/__upload", headers=headers, json=body)
print r.status_code
time.sleep(.2) #idk some time
#send chunks to POST
print 'sending chunk 1/1'
headers = {"x-mtok": "x5PfcjwqDhG39xBTE", "x-fileid": fileId, "x-chunkid": "1", "content-type": "text/plain"}
with open(filepath, "rb") as upload_file:
data = base64.b64encode(upload_file.read())
r = requests.post("http://localhost:3000/cdn/storage/Output/__upload", headers=headers, data=data)
print r.status_code
time.sleep(.2)
#send eof byte
print 'sending eof byte'
headers = {"x-mtok": "x5PfcjwqDhG39xBTE", "x-fileid": fileId, "x-eof": "1", "content-type": "text/plain"}
r = requests.post("http://localhost:3000/cdn/storage/Output/__upload", headers=headers)
print r.status_code
Using python 2.7, have tried without x-mtok and with it. The file interestingly enough shows up in the Output collection's storagePath parameter, but it doesn't seem to be added to the collection. This I assume happens after the eof is recieved which doesnt seem to be getting a response.
Python log:
got file info. fileId: 51c1cf70-ff3f-4420-b86f-4cc1c0076a89 fileSize: 35487
sending meta data and first byte
204
sending chunk 1/1
204
sending eof byte
Traceback (most recent call last):
File "test.py", line 38, in <module>
r = requests.post("http://localhost:3000/cdn/storage/Output/__upload", headers=headers)
File "C:\Python27\lib\site-packages\requests\api.py", line 112, in post
return request('post', url, data=data, json=json, **kwargs)
File "C:\Python27\lib\site-packages\requests\api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Python27\lib\site-packages\requests\sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "C:\Python27\lib\site-packages\requests\sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "C:\Python27\lib\site-packages\requests\adapters.py", line 490, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine("''",))
Meteor Server Log:
=> Started proxy.
=> A patch (Meteor 1.5.4.1) for your current release is available!
Update this project now with 'meteor update --patch'.
=> Started MongoDB.
I20180116-15:12:14.122(-6)? [FilesCollection.storagePath] Set to: C:\Users\Admin\Desktop\Agricultural ML stuff\ES-Web-Storage\Output
=> Started your app.
=> App running at: http://localhost:3000/
Type Control-C twice to stop.
I20180116-15:12:22.243(-6)? [FilesCollection] [find({}, undefined)]
I20180116-15:14:22.819(-6)? [FilesCollection] [File Start HTTP] LIDAR_Width_Avg_1.7000000000000002_inches.jpg - 51c1cf70-ff3f-4420-b86f-4cc1c0076a89
I20180116-15:14:22.821(-6)? [FilesCollection] [Upload] [HTTP Start Method] Got #-1/1 chunks, dst: LIDAR_Width_Avg_1.7000000000000002_inches.jpg
I20180116-15:14:24.046(-6)? [FilesCollection] [Upload] [HTTP] Got #1/1 chunks, dst: LIDAR_Width_Avg_1.7000000000000002_inches.jpg
I20180116-15:14:25.255(-6)? [FilesCollection] [Upload] [HTTP] Got #-1/1 chunks, dst: LIDAR_Width_Avg_1.7000000000000002_inches.jpg
Hello @out0mana ,
I'm not familiar with Python. Hopefully, @oeway could step-in with a help.
Meteor-Files you're experiencing this issueMeteor you're experiencing this issueHi guys, I am not using meteor at the moment, but I would also suggest that to look at the py-files project.
Just looked at py-files and there seems to be some bugs which I fixed.
In MeteorFiles.py
[line 106] "x-eof": str(0),
[line 108] "x-chunkId": str(i + 1),
[line 131] "x-eof": str(1),
With these changes it works as intended. You can close now (and possibly update that file)
@out0mana sounds great.
Would you send a PR?
sent PR
Please, support this project by: