-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCompiler.py
More file actions
77 lines (41 loc) · 777 Bytes
/
Compiler.py
File metadata and controls
77 lines (41 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env python
# coding: utf-8
# In[14]:
import requests
import json
# In[15]:
url = "https://ide.geeksforgeeks.org/main.php"
# In[16]:
code = """
#include<stdio.h>
int main() {
printf("hello WORLDSSASS");
return 0;
}
"""
# In[30]:
data = {
'lang': 'Cpp14',
'code': code,
'input': '',
'save': True
}
# In[31]:
r = requests.post(url, data=data)
# In[35]:
dt = r.json()
hid = dt['sid']
hid
# In[40]:
url2 = "https://ide.geeksforgeeks.org/submissionResult.php"
data2 = {
'sid': hid,
'requestType': 'fetchResults'
}
k = requests.post(url2 , data = data2)
result = k.json()
while(result['status'] =='IN-QUEUE'):
k = requests.post(url2 , data = data2)
result = k.json()
result['output']
# In[ ]: