Spaces:
Sleeping
Sleeping
| import requests | |
| API_BASE = "https://gaia-agent-api.spacelab.dev" | |
| def get_all_questions(): | |
| print(f"[INFO] Fetching: {API_BASE}/questions") | |
| response = requests.get(f"{API_BASE}/questions") | |
| print("[DEBUG] Status Code:", response.status_code) | |
| print("[DEBUG] Raw Response:", response.text[:500]) # limit to 500 chars | |
| response.raise_for_status() # raise if 4xx/5xx | |
| return response.json() | |
| def get_random_question(): | |
| return requests.get(f"{API_BASE}/random-question").json() | |
| def get_file(task_id, filename): | |
| url = f"{API_BASE}/files/{task_id}/{filename}" | |
| r = requests.get(url) | |
| r.raise_for_status() | |
| return r.content | |
| def submit_answers(username, code_link, answers): | |
| payload = { | |
| "username": username, | |
| "agent_code": code_link, | |
| "answers": answers | |
| } | |
| r = requests.post(f"{API_BASE}/submit", json=payload) | |
| return r.json() |