File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -9,15 +9,21 @@ class CodeforcesParser:
9
9
def get_solution (self , contest_id , submit_id ):
10
10
"""
11
11
Returns source code for specified submit.
12
+
13
+ contest_id is the id of contest.
14
+
15
+ submit_id is the id of sumbission.
12
16
"""
13
17
solutionPage = requests .get (
14
18
"https://codeforces.com/contest/"
15
19
+ str (contest_id )
16
20
+ "/submission/"
17
21
+ str (submit_id )
18
22
)
23
+ if int (solutionPage .status_code ) != 200 :
24
+ raise Exception ("Returned not OK code" + str (solutionPage ))
19
25
tree2 = html .fromstring (solutionPage .text )
20
26
code = tree2 .xpath ('//*[@id="pageContent"]/div[3]/pre/text()' )
21
27
if len (code ) == 0 :
22
- raise ValueError ("Incorrect contest_id or submit_id" )
28
+ raise ValueError ("Incorrect contest_id or submit_id" + str ( code ) )
23
29
return code [0 ].replace ("\r " , "" )
Original file line number Diff line number Diff line change 5
5
6
6
setup (
7
7
name = "CodeforcesApiPy" ,
8
- version = "1.3.2 " ,
8
+ version = "1.3.3 " ,
9
9
description = "Implementation of codeforces.com API" ,
10
10
platforms = "any" ,
11
11
url = "https://github.com/VadVergasov/CodeforcesApiPy" ,
You can’t perform that action at this time.
0 commit comments