Files
crewai/check_error.py
2026-03-13 18:12:31 +08:00

23 lines
621 B
Python

import requests
import time
# Start a task
print("Starting task...")
response = requests.post('http://localhost:8000/api/v1/sdlc/start', json={'requirement': 'test'})
task_id = response.json()['task_id']
print(f"Task ID: {task_id}")
# Wait 2 seconds
time.sleep(2)
# Get status
status = requests.get(f'http://localhost:8000/api/v1/sdlc/status/{task_id}')
print(f"\nStatus: {status.json()}")
# Get events via SSE stream
print("\nGetting events...")
stream = requests.get(f'http://localhost:8000/api/v1/sdlc/stream/{task_id}', timeout=5)
for line in stream.iter_lines():
if line:
print(line.decode('utf-8'))