Skip to content

Commit 5c1963b

Browse files
committed
Added handling incorrect values in get_solution
1 parent a77e637 commit 5c1963b

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ dist/
22
build/
33
CodeforcesApiPy.egg-info
44
tests/conf.py
5+
tests/__pycache__/
56
.pylintrc
67
codeforces_api/__pycache__/

codeforces_api/parse_methods.py

+2
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ def get_solution(self, contest_id, submit_id):
1818
)
1919
tree2 = html.fromstring(solutionPage.text)
2020
code = tree2.xpath('//*[@id="pageContent"]/div[3]/pre/text()')
21+
if len(code) == 0:
22+
raise ValueError("Incorrect contest_id or sumbit_id")
2123
return code[0].replace("\r", "")

0 commit comments

Comments
 (0)