8
8
9
9
10
10
RAPID_API_KEY = "" # Get yours at https://judge0.com/extra-ce
11
+ SULU_API_KEY = "" # Get your at https://sparkhub.sulu.sh
11
12
12
- JUDGE0_API_BASE = "https://judge0-extra-ce.p.rapidapi.com "
13
+ JUDGE0_API_BASE = "https://judge0-extra-ce.p.sulu.sh "
13
14
RAPID_API_HEADERS = {
14
15
"X-RapidAPI-Key" : RAPID_API_KEY ,
15
16
"X-RapidAPI-Host" : "judge0-extra-ce.p.rapidapi.com" ,
16
17
}
18
+ SULU_API_HEADERS = {
19
+ "Authorization" : f"Bearer { SULU_API_KEY } "
20
+ }
17
21
JUDGE0_PENDING_STATUS_IDS = [1 , 2 ]
18
22
19
23
# This is the script that will be executed. User writes this script.
@@ -80,7 +84,8 @@ def run_script(script: str):
80
84
# Always send the data as base64 encoded with base64_encoded=true.
81
85
res = requests .post (
82
86
url = f"{ JUDGE0_API_BASE } /submissions?base64_encoded=true" ,
83
- headers = RAPID_API_HEADERS ,
87
+ # headers=RAPID_API_HEADERS,
88
+ headers = SULU_API_HEADERS ,
84
89
json = data ,
85
90
)
86
91
@@ -91,7 +96,8 @@ def run_script(script: str):
91
96
# Always request the output as base64 encoded with base64_encoded=true.
92
97
res = requests .get (
93
98
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 ,
95
101
timeout = 1 ,
96
102
)
97
103
0 commit comments