18 lines
485 B
Python
18 lines
485 B
Python
#!/usr/bin/env python3
|
|
import requests
|
|
import os.path
|
|
import json
|
|
|
|
FILE = '/home/marcsello/CommonStarling_102761_45.wav'
|
|
TAG = 'test'
|
|
|
|
# Files structure: (filename, data, content_type, headers)
|
|
|
|
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()
|