File size: 901 Bytes
9cf3d4c
 
15dd8d3
9cf3d4c
 
fff4806
 
 
 
 
 
 
 
 
9cf3d4c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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()