-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_backend_connection.py
More file actions
29 lines (25 loc) Β· 1.04 KB
/
test_backend_connection.py
File metadata and controls
29 lines (25 loc) Β· 1.04 KB
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
import requests
import time
# Test if backend is responding
url = "http://127.0.0.1:8002/api/analyze/analyze-filename"
data = {
"filename": "test_video.mp4",
"metadata": {"duration": 120}
}
print("π§ Testing backend connection...")
time.sleep(1) # Give backend time to settle
try:
response = requests.post(url, json=data, timeout=10)
print(f"β
Backend responding! Status: {response.status_code}")
result = response.json()
print(f"β
Analysis endpoint working: {result.get('success', False)}")
if result.get('success'):
print(f"β
Analysis data received: {len(result.get('analysis', {}))} sections")
print(f"β
Recommendations received: {len(result.get('recommendations', []))} items")
except requests.exceptions.ConnectionError:
print("β Connection failed: Backend not running or wrong port")
except requests.exceptions.Timeout:
print("β Connection timeout: Backend taking too long to respond")
except Exception as e:
print(f"β Backend connection failed: {e}")
print("β
Test completed")