This commit is contained in:
23
tester.py
Normal file
23
tester.py
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env python3
|
||||
import requests
|
||||
import os.path
|
||||
import json
|
||||
from datetime import datetime
|
||||
|
||||
#URL = "https://birb.kmlabz.com/api/input/v1/sample"
|
||||
#URL = "http://spitfire:30069/api/input/v1/sample"
|
||||
URL = "http://localhost:5000/sample"
|
||||
|
||||
FILE = 'CommonStarling_100962.wav'
|
||||
|
||||
files = {
|
||||
"file": (os.path.basename(FILE), open(FILE,'rb').read(), 'audio/wave', {'Content-length' : os.path.getsize(FILE)}),
|
||||
"description" : (None, json.dumps({'date' : datetime.now().isoformat(), 'device_id' : '123'}), "application/json")
|
||||
}
|
||||
|
||||
r = requests.post(URL,files=files)
|
||||
print("Content: ", r.content)
|
||||
print("Headers:", r.headers)
|
||||
r.raise_for_status()
|
||||
|
||||
#print(r.json())
|
||||
Reference in New Issue
Block a user