-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_frontend_api.py
More file actions
48 lines (41 loc) Β· 1.51 KB
/
test_frontend_api.py
File metadata and controls
48 lines (41 loc) Β· 1.51 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
"""
Test the frontend API connection to see exact data flow
"""
import requests
import json
# Test the exact API call the frontend makes
url = "http://127.0.0.1:8002/api/analyze/analyze-filename"
data = {
"filename": "test_video.mp4"
}
print("π§ Testing frontend API call...")
print(f"URL: {url}")
print(f"Request data: {json.dumps(data, indent=2)}")
print()
try:
response = requests.post(url, json=data, timeout=10)
print(f"β
Response Status: {response.status_code}")
print(f"β
Response Headers: {dict(response.headers)}")
print()
if response.status_code == 200:
result = response.json()
print("β
Response JSON:")
print(json.dumps(result, indent=2))
print()
# Check if analysis data exists
if result.get('success') and result.get('analysis'):
analysis = result['analysis']
print("π Analysis sections found:")
print(f" - Scenes: {len(analysis.get('scenes', []))}")
print(f" - Emotions: {len(analysis.get('emotions', []))}")
print(f" - Audio: {'Yes' if analysis.get('audio_analysis') else 'No'}")
print(f" - Recommendations: {len(result.get('recommendations', []))}")
else:
print("β No analysis data in response")
else:
print(f"β HTTP Error: {response.status_code}")
print(f"Response text: {response.text}")
except Exception as e:
print(f"β Request failed: {e}")
print("\nβ
Test completed")