27 lines
910 B
Python
27 lines
910 B
Python
#!/usr/bin/env python3
|
|
"""Test: HTTP POST large JSON body — does it pass DPI?"""
|
|
import requests, base64, os, json, time
|
|
|
|
# Fake audio of various sizes
|
|
for kb in [30, 50, 70, 100, 150]:
|
|
audio_b64 = base64.b64encode(os.urandom(kb * 1024)).decode()
|
|
body = json.dumps({"audio_b64": audio_b64, "mime": "audio/webm"})
|
|
size = len(body)
|
|
|
|
t0 = time.time()
|
|
try:
|
|
r = requests.post(
|
|
"https://proxy.kube5s.ru/",
|
|
data=body,
|
|
headers={"Content-Type": "application/json"},
|
|
timeout=30
|
|
)
|
|
dt = time.time() - t0
|
|
print(f" {kb}KB audio → JSON {size/1024:.1f}KB: HTTP {r.status_code} in {dt:.1f}s ✅")
|
|
except requests.Timeout:
|
|
print(f" {kb}KB audio → JSON {size/1024:.1f}KB: TIMEOUT ❌")
|
|
except Exception as e:
|
|
print(f" {kb}KB audio → JSON {size/1024:.1f}KB: ERR {e}")
|
|
|
|
time.sleep(1)
|