input-service/test.py
Torma Kristóf 3d67c5e815
All checks were successful
continuous-integration/drone/push Build is passing
one time format
2020-05-22 00:10:10 +02:00

20 lines
544 B
Python

#!/usr/bin/env python3
import requests
import os.path
import json
from datetime import datetime
URL = "http://127.0.0.1:8080/sample"
FILE = 'CommonStarling_102761_45.wav'
files = {
"file": (os.path.basename(FILE), open(FILE,'rb').read(), 'audio/wave', {'Content-length' : os.path.getsize(FILE)}),
"description" : (None, json.dumps({"date" : today.strftime("%Y-%m-%d %H:%M:%S"), "device_id" : "123"}), "application/json")
}
r = requests.post(URL,files=files)
print("Content: ", r.content)
print("Headers:", r.headers)
r.raise_for_status()