diff options
author | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2018-10-13 03:30:35 +0200 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2018-10-13 03:30:35 +0200 |
commit | 4abbcde4b21be7d3c07a2d483c23a951ff57cb12 (patch) | |
tree | 1b4d291d69104ed5fe12a4e68a4659862861c8b0 /kpov_judge | |
parent | b41b2bebc05585a6e374dafafae9bed2503becad (diff) |
Fix urllib for Python 3
Diffstat (limited to 'kpov_judge')
-rwxr-xr-x | kpov_judge/add_task.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kpov_judge/add_task.py b/kpov_judge/add_task.py index 92e0c37..ea11c9c 100755 --- a/kpov_judge/add_task.py +++ b/kpov_judge/add_task.py @@ -15,10 +15,10 @@ def task_check(results, params): data = urllib.parse.urlencode({ 'results': json.dumps(results), 'params': json.dumps(params) - }) + }).encode() req = urllib.request.Request('{task_url}/{task_name}/results.json'.format(task_url=task_url, task_name=task_name), data) response = urllib.request.urlopen(req) - response_dict = json.loads(response.read()) + response_dict = json.loads(response.read().decode()) hints = response_dict.get('hints', []) hints = ['status: ' + response_dict.get('status', '')] + hints return response_dict.get('result', 'No result'), "\n".join(hints) |