From ceba1fdc27ae1b19d6bb04e00cdf6e54484d1b69 Mon Sep 17 00:00:00 2001 From: Patrik Winroth Date: Wed, 29 Mar 2023 10:38:48 +0200 Subject: [PATCH] Update server.py --- scripts/server.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/server.py b/scripts/server.py index 7e478df..2225f0d 100755 --- a/scripts/server.py +++ b/scripts/server.py @@ -12,6 +12,7 @@ import operator import socket import threading import os +import gzip from utils.notifications import sendAppriseNotifications from utils.parse_settings import config_to_settings @@ -534,7 +535,9 @@ def handle_client(conn, addr): with open(args.i, 'rb') as f: wav_data = f.read() - response = requests.post(url=soundscape_url, data=wav_data, headers={'Content-Type': 'application/octet-stream'}) + gzip_wav_data = gzip.compress(wav_data) + response = requests.post(url=soundscape_url, data=gzip_wav_data, headers={'Content-Type': 'application/octet-stream', + 'Content-Encoding': 'gzip'}) print("Soundscape POST Response Status - ", response.status_code) sdata = response.json() soundscape_id = sdata['soundscape']['id']