Skip to content

Commit a61e35f

Browse files
author
Samuel Alarco
committed
chore: Add Sulu Auth to python-image-as-output
1 parent a26f099 commit a61e35f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

python-image-as-output/plot.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88

99

1010
RAPID_API_KEY = "" # Get yours at https://judge0.com/extra-ce
11+
SULU_API_KEY = "" # Get your at https://sparkhub.sulu.sh
1112

12-
JUDGE0_API_BASE = "https://judge0-extra-ce.p.rapidapi.com"
13+
JUDGE0_API_BASE = "https://judge0-extra-ce.p.sulu.sh"
1314
RAPID_API_HEADERS = {
1415
"X-RapidAPI-Key": RAPID_API_KEY,
1516
"X-RapidAPI-Host": "judge0-extra-ce.p.rapidapi.com",
1617
}
18+
SULU_API_HEADERS = {
19+
"Authorization": f"Bearer {SULU_API_KEY}"
20+
}
1721
JUDGE0_PENDING_STATUS_IDS = [1, 2]
1822

1923
# This is the script that will be executed. User writes this script.
@@ -80,7 +84,8 @@ def run_script(script: str):
8084
# Always send the data as base64 encoded with base64_encoded=true.
8185
res = requests.post(
8286
url=f"{JUDGE0_API_BASE}/submissions?base64_encoded=true",
83-
headers=RAPID_API_HEADERS,
87+
# headers=RAPID_API_HEADERS,
88+
headers=SULU_API_HEADERS,
8489
json=data,
8590
)
8691

@@ -91,7 +96,8 @@ def run_script(script: str):
9196
# Always request the output as base64 encoded with base64_encoded=true.
9297
res = requests.get(
9398
url=f"{JUDGE0_API_BASE}/submissions/{token}?base64_encoded=true",
94-
headers=RAPID_API_HEADERS,
99+
# headers=RAPID_API_HEADERS,
100+
headers=SULU_API_HEADERS,
95101
timeout=1,
96102
)
97103

0 commit comments

Comments
 (0)