upload multiparttest
This commit is contained in:
parent
28c829bd83
commit
33311e752a
18
multiparttest.py
Normal file
18
multiparttest.py
Normal file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
import requests
|
||||
import os.path
|
||||
import json
|
||||
|
||||
FILE = '/home/marcsello/CommonStarling_102761_45.wav'
|
||||
TAG = 'nigga'
|
||||
|
||||
#(filename, data, content_type, headers)
|
||||
#{'file': ('report.xls', open('report.xls', 'rb'), 'application/vnd.ms-excel', {'Expires': '0'})}
|
||||
|
||||
files = {
|
||||
"soundFile": (os.path.basename(FILE),open(FILE,'rb').read(),'audio/wave',{'Content-length' : os.path.getsize(FILE)}),
|
||||
"description" : (None, json.dumps({'tag' : TAG}),"application/json")
|
||||
}
|
||||
|
||||
r = requests.post('http://localhost:5000/object',files=files)
|
||||
r.raise_for_status()
|
Loading…
Reference in New Issue
Block a user