diff options
-rwxr-xr-x | kpov_judge/test_task.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/kpov_judge/test_task.py b/kpov_judge/test_task.py index d79c0e5..3fad962 100755 --- a/kpov_judge/test_task.py +++ b/kpov_judge/test_task.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +import io import yaml import json import urllib.request, urllib.parse, urllib.error -import urllib.request, urllib.error, urllib.parse try: from dialog import Dialog except: @@ -192,8 +192,8 @@ if __name__ == '__main__': task_params.update(gen_params(params['username'], task_params_meta)) # print ("params after: {} {}".format(params, task_params)) if task_url.startswith('http'): - req = urllib.request.Request("{task_url}/{task_name}/params.json".format(**params)) - web_task_params = json.load(urllib.request.urlopen(req)) + response = urllib.request.urlopen('{task_url}/{task_name}/params.json'.format(**params)) + web_task_params = json.load(io.TextIOWrapper(response)) task_params.update(web_task_params) params_argparser = argparse.ArgumentParser(parents=[argparser], conflict_handler='resolve', add_help=True) params_argparser = add_meta_to_argparser(params_argparser, task_params_meta, defaults=task_params) |