Spaces:
Sleeping
Sleeping
File size: 553 Bytes
843f9cb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import requests
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
def fetch_questions():
response = requests.get(f"{DEFAULT_API_URL}/questions", timeout=15)
response.raise_for_status()
return response.json()
def submit_answers(username, agent_code, answers):
payload = {
"username": username.strip(),
"agent_code": agent_code,
"answers": answers
}
response = requests.post(f"{DEFAULT_API_URL}/submit", json=payload, timeout=60)
response.raise_for_status()
return response.json()
|