Add 'manual_run.py'

This commit is contained in:
Pünkösd Marcell 2020-04-30 01:18:55 +02:00
parent 63c913571d
commit 7e11249b08
1 changed files with 19 additions and 0 deletions

19
manual_run.py Normal file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env python3
import requests
import os.path
import json
from datetime import datetime
URL = "http://10.97.160.25/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()