Skip to content

Commit 7895cae

Browse files
committed
Added more detailed logging
1 parent 998ec15 commit 7895cae

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

codeforces_api/parse_methods.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,21 @@ class CodeforcesParser:
99
def get_solution(self, contest_id, submit_id):
1010
"""
1111
Returns source code for specified submit.
12+
13+
contest_id is the id of contest.
14+
15+
submit_id is the id of sumbission.
1216
"""
1317
solutionPage = requests.get(
1418
"https://codeforces.com/contest/"
1519
+ str(contest_id)
1620
+ "/submission/"
1721
+ str(submit_id)
1822
)
23+
if int(solutionPage.status_code) != 200:
24+
raise Exception("Returned not OK code" + str(solutionPage))
1925
tree2 = html.fromstring(solutionPage.text)
2026
code = tree2.xpath('//*[@id="pageContent"]/div[3]/pre/text()')
2127
if len(code) == 0:
22-
raise ValueError("Incorrect contest_id or submit_id")
28+
raise ValueError("Incorrect contest_id or submit_id" + str(code))
2329
return code[0].replace("\r", "")

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="CodeforcesApiPy",
8-
version="1.3.2",
8+
version="1.3.3",
99
description="Implementation of codeforces.com API",
1010
platforms="any",
1111
url="https://github.com/VadVergasov/CodeforcesApiPy",

0 commit comments

Comments
 (0)