Spaces:
Sleeping
Sleeping
Create submit.py
Browse files
submit.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
|
| 3 |
+
GAIA_API = "https://gaia-course-api.spacelab.dev"
|
| 4 |
+
|
| 5 |
+
def submit_answers(username: str, code_link: str, answers: list):
|
| 6 |
+
payload = {
|
| 7 |
+
"username": username,
|
| 8 |
+
"space": code_link,
|
| 9 |
+
"answers": answers,
|
| 10 |
+
}
|
| 11 |
+
response = requests.post(f"{GAIA_API}/submit", json=payload)
|
| 12 |
+
if response.status_code == 200:
|
| 13 |
+
return "✅ Submission successful!"
|
| 14 |
+
else:
|
| 15 |
+
return f"❌ Submission failed: {response.status_code} - {response.text}"
|