54 lines
1.6 KiB
Python
54 lines
1.6 KiB
Python
"""
|
|
Test script to debug 403 error when fetching tasks for a shot
|
|
"""
|
|
import requests
|
|
|
|
# Configuration
|
|
BASE_URL = "http://localhost:8000"
|
|
SHOT_ID = 11
|
|
|
|
# Login as admin to get token
|
|
login_response = requests.post(
|
|
f"{BASE_URL}/auth/login",
|
|
json={"email": "admin@vfx.com", "password": "admin123"}
|
|
)
|
|
|
|
if login_response.status_code == 200:
|
|
token = login_response.json()["access_token"]
|
|
print(f"✓ Logged in successfully")
|
|
print(f"Token: {token[:50]}...")
|
|
|
|
# Try to get tasks for shot
|
|
headers = {"Authorization": f"Bearer {token}"}
|
|
tasks_response = requests.get(
|
|
f"{BASE_URL}/tasks",
|
|
params={"shot_id": SHOT_ID},
|
|
headers=headers
|
|
)
|
|
|
|
print(f"\nGET /tasks?shot_id={SHOT_ID}")
|
|
print(f"Status: {tasks_response.status_code}")
|
|
print(f"Response: {tasks_response.text[:500]}")
|
|
|
|
if tasks_response.status_code == 200:
|
|
tasks = tasks_response.json()
|
|
print(f"\n✓ Found {len(tasks)} tasks")
|
|
for task in tasks:
|
|
print(f" - {task['name']} ({task['task_type']}) - {task['status']}")
|
|
else:
|
|
print(f"\n✗ Error: {tasks_response.status_code}")
|
|
|
|
# Also try to get the shot details
|
|
shot_response = requests.get(
|
|
f"{BASE_URL}/shots/{SHOT_ID}",
|
|
headers=headers
|
|
)
|
|
print(f"\nGET /shots/{SHOT_ID}")
|
|
print(f"Status: {shot_response.status_code}")
|
|
if shot_response.status_code == 200:
|
|
shot = shot_response.json()
|
|
print(f"Shot: {shot['name']} (Project ID: {shot['project_id']})")
|
|
else:
|
|
print(f"✗ Login failed: {login_response.status_code}")
|
|
print(login_response.text)
|