-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_timing.py
More file actions
34 lines (27 loc) · 765 Bytes
/
test_timing.py
File metadata and controls
34 lines (27 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
Test API response time
"""
import requests
import time
print("Testing API response time...")
print("Starting timer...")
start = time.time()
response = requests.post(
"http://localhost:8000/analyze",
json={
"text": "LAST CHANCE! Only 127 people viewing! Accept all cookies now!",
"buttons": ["ACCEPT ALL", "maybe later"]
}
)
end = time.time()
elapsed = end - start
print(f"\n{'='*60}")
print(f"Response Time: {elapsed:.2f} seconds")
print(f"{'='*60}")
if elapsed > 10:
print(f"[WARNING] Response took longer than 10s timeout")
print(f"[FIX] Extension timeout increased to 30s")
else:
print(f"[OK] Response within original 10s timeout")
print(f"\nStatus: {response.status_code}")
print(f"Result: {response.json()}")