From 4abbcde4b21be7d3c07a2d483c23a951ff57cb12 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Sat, 13 Oct 2018 03:30:35 +0200 Subject: Fix urllib for Python 3 --- kpov_judge/add_task.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'kpov_judge') 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) -- cgit v1.2.1