Final_Assignment_Template / api_client.py
Umer797's picture
Update api_client.py
843f9cb verified
raw
history blame
553 Bytes
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()